Author: enrico-sorichetti
Subject: Reply to: Need to code a Rexx PGM
Posted: Thu Oct 06, 2016 11:12 pm (GMT 5.5)
dave,
You answered the other topic misleading requirement,
in this case no reformatting needed,
just write in the report the offending line
here is a snippet for the actual requirement
it assumes that a stem has been already filled with the data
and it contains only valid records
TESTED AND WORKING
anyway the topic is going to be locked very shortly
I / we wasted already too much time on it
I confirm the suggestion for the TS to migrate to the beginners forum
and I will undertake the appropriate actions
_________________
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort![icon_cool.gif]()
Subject: Reply to: Need to code a Rexx PGM
Posted: Thu Oct 06, 2016 11:12 pm (GMT 5.5)
dave,
You answered the other topic misleading requirement,
in this case no reformatting needed,
just write in the report the offending line
here is a snippet for the actual requirement
it assumes that a stem has been already filled with the data
and it contains only valid records
Code: |
data.1 = " NEW:ABC.EPY(PGM1) OLD:ABC.POU(PGM1)" data.2 = "I - 0001 MOVE 5 TO WS-VAR1" data.3 = "I - 0010 MOVE 8 TO WS-VAR2" data.4 = "D - 0010 MOVE 5 TO WS-VAR2" data.5 = "I - 0020 MOVE 'ALPHA' TO WS-NAME" data.6 = " NEW:ABC.EPY(PGM2) OLD:ABC.POU(PGM2)" data.7 = "I - 0001 MOVE 5 TO WS-VAR1" data.8 = "I - 0010 MOVE 8 TO WS-VAR2" data.9 = "D - 0010 MOVE 5 TO WS-VAR2" data.0 = 9 keyw.1 = "TO" ; keyp.1 = 29 ; keyw.2 = "PIC" ; keyp.2 = 29 ; keyw.3 = "VALUE" ; keyp.3 = 51 ; keyw.0 = 3 prog = "" do d = 1 to data.0 data = data.d if pos("NEW:", data) > 0 then do if prog \= "" then do say "end of data for prog =" prog say "" /* write some trailer for the old program */ end parse var data . "(" prog ")" . say "start of data for prog =" prog /* write some header for the new program */ iterate end do k = 1 to keyw.0 keyp = pos(" "keyw.k" ", data ) -- say keyw.k keyp if keyp > 0 & , keyp \= keyp.k then do say "error " ">>"data"<< at "keyp /* write the detail record for the error */ iterate d end end end /* process the dangling trailer */ if prog \= "" then do say "end of data for prog =" prog say "" /* write some trailer for the old program */ end |
TESTED AND WORKING
anyway the topic is going to be locked very shortly
I / we wasted already too much time on it
I confirm the suggestion for the TS to migrate to the beginners forum
and I will undertake the appropriate actions
_________________
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
