Code: |
/* REXX for expanding cobol program This will create/replace member with same name as the current one in the user supplied dsn or default one. Exaples to invoke - 1 xpand complete.dataset.name 2 xpand */ address ISREDIT "MACRO (dsn)" "(userstat) = USER_STATE" "(member) = MEMBER" if length(dsn) = 0 then dsn = 'tso.pies.macros' dsn = dsn||'('member||')' "REC ON" "CAPS OFF" /* find first copy code and start expanding */ "FIND ' COPY ' 7 12 FIRST" do while rc = 0 "(currline) = LINE .ZCSR" copybook = word(substr(currline,13,60),1) copybook_len = length(copybook) if substr(copybook,copybook_len,1) = '.' then copybook = substr(copybook,1,(copybook_len-1)) "COPY "copybook" AFTER .ZCSR" /* find next copy code */ "FIND ' COPY ' 7 12 NEXT" end "CREATE '"dsn"' .ZFIRST .ZLAST" if rc > 0 then do "REPLACE '"dsn"' .ZFIRST .ZLAST" if rc > 0 then say 'Problem in saving to '''dsn'''' end /* "UNDO" this is not working so you will have to undo manually */ "RESET FIND" "USER_STATE =(userstat)" exit |
Code: |
"COPY '"dsn.1"("copybook")' AFTER .ZCSR" If rc > 0 then "COPY '"dsn.2"("copybook")' AFTER .ZCSR" If rc > 0 then "COPY '"dsn.3"("copybook")' AFTER .ZCSR" If rc > 0 then "COPY '"dsn.4"("copybook")' AFTER .ZCSR" If rc > 0 then nop /* not found */ OR Do i = 1 to 4 "COPY '"dsn.i"("copybook")' AFTER .ZCSR" If rc = 0 then leave Else nop End |
Code: |
,******************************************** ,*, ,*,Command in error . :,%UND ,*, ,*,Command not found , ,*,"UNDO" is not an edit command or macro. ,*, ,*, Error message ID . :,ISRE453 , ,*, ,*, Last return code . :,20 , ,*, ,*, Macro executing . :,UNDO , ,*, ,*,Press,ENTER,key to terminate the macro. ,******************************************** |
output generated using printer-friendly topic mod. All times are GMT - 5 Hours