Copybook REXX
Copybook REXX
Copybook REXX
This component uses Cursor concept in ISREDIT to open a copybook without FILEMANAGER, using Filemanager Interface for REXX.
HOW TO USE:
Code:
Store this code in the member name CB in a dataset allocated to SYSPROC or SYSEXEC. Type CB in the command line. Place the cursor at the start of copybook member name and press enter. A dataset will be opened, which should be created before this. It will have the same format as when a copybook is viewed in FileManager.
/*--------------------------- REXX ----------------------------------*/ ADDRESS ISPEXEC "CONTROL ERRORS RETURN" ADDRESS ISPEXEC ADDRESS ISREDIT "MACRO" DSNNAME = DSN of copylib CPYNAME = '' "(ROW, COL) = CURSOR" "(MEMLINE) = LINE .ZCSR" /*SAY MEMLINE */ IF(INDEX(MEMLINE,'COPY') \= 0 & INDEX(MEMLINE,'INCLUDE') \= 0) THEN SAY INDEX HH=WORDS(MEMLINE) IF HH=2 THEN CPYNAME = WORD(MEMLINE,2) ELSE CPYNAME = WORD(MEMLINE,HH) CPYNAM=SUBSTR(CPYNAME,1,8) IF(SUBSTR(MEMLINE,1,4) = '-INC') THEN CPYNAME = WORD(MEMLINE,2) IF(CPYNAME = '') THEN DO SAY 'COPY NAME IS ' CPYNAME SAY 'S -> CURSOR NOT IN PLACE...' EXIT END ADDRESS TSO "FREE DD(SYSIN SYSPRINT)"
"ALLOC DD(SYSPRINT) NEW LRECL(134) RECFM(F B) DSORG(PS)", ||"SPACE(1 1) CYL" "ALLOC DA('Create DSN and give here of LRECL 133') F(DATAOUT) SHR REUSE" "ALLOC DD(SYSIN) NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE SPACE(1) TRA" PGM_DSN='Create DSN and give here of LRECL 133' MBR=EMOUTPUT; PARM.0 = 3; PARM.1 = "$$FILEM SET HEADERPG=NO" PARM.2 = "$$FILEM PBK DSNIN=DSN of copylib," PARM.3 = "$$FILEM MEMBER="CPYNAM"" "EXECIO * DISKW SYSIN (STEM PARM. FINIS" "CALL *(FMNMAIN) '/BATCH'" /* OR "FILEMGR '/BATCH'" SAY RC */ "EXECIO * DISKR SYSPRINT (STEM SP. FINIS" J=1 DO I = 8 TO SP.0 SPP.J=SP.I J=J+1 END "EXECIO * DISKW DATAOUT(FINIS STEM "SPP. "FREE F(DATAOUT)" "ALLOC F(TOTRIM) DA('"||PGM_DSN||"') SHR REUSE" "EXECIO * DISKR TOTRIM (STEM TRIMLNO. FINIS" "FREE F(TOTRIM)" K=1 DO LINE=1 TO TRIMLNO.0 TOWRITE.K = SUBSTR(TRIMLNO.LINE,1,50), ||" "SUBSTR(TRIMLNO.LINE,101,33) K=K+1 END "ALLOC F(TOTRIM) DA('"||PGM_DSN||"') SHR REUSE" "EXECIO * DISKW TOTRIM(STEM TOWRITE. FINIS" "FREE F(TOTRIM)" ADDRESS ISPEXEC "LMINIT DATAID(DSID) DATASET ('"PGM_DSN"') ENQ(SHR)" "VIEW DATAID("DSID")" "LMCLOSE DATAID("DSID")" "LMFREE DATAID("DSID")" "END" EXIT