1. Read a block, use XSNAP to print it, all 256 bytes.
2. Skip two bytes to find the first name
3. After the name, skip 3 bytes (the TTR value) and read the C value (1 byte).
4. The last 5 bits of the C byte gives us the length of the user data field in halfwords. Use this to advance in the block to the next name: the start of the first name + 4 bytes for TTR and C + the length of the user data field.
I have done this a different way (which works) but I would like to know how I can make it better if possible.
//STEP1 EXEC PROC=ASMACLG
//C.SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR
// DD DSN=KC02293.SYS2.MACLIB,DISP=SHR
//C.SYSIN DD *
MAIN CSECT
PRINT NOGEN
STM 14,12,12(13)
LR 12,15
USING MAIN,12
LA 14,MAINSAVE
ST 13,4(0,14)
ST 14,8(0,13)
LR 13,14
*
OPEN (PDDCB,(INPUT))
LTR 15,15
BZ OPEN10K
ABEND 333,DUMP
*
OPEN10K OPEN (OUTDCB,(OUTPUT))
LTR 15,15
BZ OPEN20K
ABEND 444,DUMP
*
OPEN20K DS 0H
*
OUTLOOP GET PDDCB,PDSBUF
CLI EOFFLAG2,C'Y'
*
BE ENDLOOP
PUT OUTDCB,OUTHDR
XSNAP STORAGE=(PDSBUF,PDSBUF+256),T=NOREGS
LA 2,PDSBUF
LA 2,2(0,2)
INLOOP DS 0H
CLC 0(8,2),=8X'FF'
BZ DONE
MVC RECORD(8),0(2)
PUT OUTDCB,PRINTLN
IC 4,11(2)
SLA 4,27(0)
SRA 4,26(0)
LA 2,12(4,2)
B INLOOP
DONE PUT OUTDCB,EMPTY
B OUTLOOP
ENDLOOP DC 0H
*
CLOSE (PDDCB)
LTR 15,15
BZ CLOSE10K
ABEND 666,DUMP
*
CLOSE10K CLOSE (OUTDCB)
LTR 15,15
BZ CLOSE20K
ABEND 777,DUMP
*
CLOSE20K DS 0H
SR 15,15
*
L 13,4(0,13)
LM 14,12,12(13)
BR 14
LTORG
*
***************************************************************
MAINSAVE DS 18F'-1' MAINSAVE AREA
PRINTLN DC C' ' RECORD TITLE
RECORD DS CL79' '
OUTHDR DC CL80' DATA MEMBERS STORED IN PDSE'
EMPTY DC 80C' '
*
PDSBUF DS CL256
*
PDDCB DCB DDNAME=INLIB, X
DEVD=DA, X
DSORG=PS, X
MACRF=GM, X
RECFM=F, X
LRECL=256, X
BLKSIZE=256, X
EODAD=PDSEOF
*
EOFFLAG2 DC C'N'
*
PDSEOF MVI EOFFLAG2,C'Y'
BR 14
*
OUTDCB DCB DDNAME=OUTPUT, X
DEVD=DA, X
DSORG=PS, X
MACRF=PM, X
LRECL=80, X
RECFM=FB
*
END MAIN
/*
//L.SYSLIB DD DSN=KC02293.SYS2.CALLIB,DISP=SHR
//G.OUTPUT DD SYSOUT=*
//G.XSNAPOUT DD SYSOUT=*
//G.XPRNT DD SYSOUT=*
//*
//*
//G.INDATA DD DSN=KC02314.SPRING16.CSCI641.HW3DATA,DISP=SHR
//G.INLIB DD DSN=KC02314.SPRING16.CSCI641.HW3LIBA,DISP=SHR
// DD DSN=KC02314.SPRING16.CSCI641.HW3LIBB,DISP=SHR
The code in question I want modify if possible is:
OUTLOOP GET PDDCB,PDSBUF
CLI EOFFLAG2,C'Y'
*
BE ENDLOOP
PUT OUTDCB,OUTHDR
XSNAP STORAGE=(PDSBUF,PDSBUF+256),T=NOREGS
LA 2,PDSBUF
LA 2,2(0,2)
INLOOP DS 0H
CLC 0(8,2),=8X'FF'
BZ DONE
MVC RECORD(8),0(2)
PUT OUTDCB,PRINTLN
IC 4,11(2)
SLA 4,27(0)
SRA 4,26(0)
LA 2,12(4,2)
B INLOOP
DONE PUT OUTDCB,EMPTY
B OUTLOOP
Any help would be great.