Thanks Barry for the comments. But because of the spirited conversation that 
came out of it, I am glad I had the WTO this time and will try to stay away 
from it in the future. Hopefully I can use your other comments to greatly 
improve my program. On the humorous side, you still have operators. We have not 
had those for years. 

I am glad you did not notice I wimped out and put the multi-segment logic in a 
COBOL program that followed the JCL. Maybe I could take the assembler listing 
from the cobol compile and add it to my assembler code like I coded it. I did 
try to work with binary and packed formatted field so my cobol program did not 
spend all its time converting from binary to packed to decimal.   

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of 
Schwarz, Barry A
Sent: Wednesday, March 16, 2011 2:03 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: Trouble Reading a Spanned File with an Assembler Program - Working 
Program

Save areas should be chained in both directions.

A comment that simply repeats the code serves only to clutter the listing.

Other than BADOPEN, you never call any of the error routines.

Why two symbols (BATA and OUTREC) for the exact same area of memory.

You include the RDW and segment data in the output record.

You don't process the segment data at all.  If a logical record actually spans 
segments you will never detect it.  You will also produce multiple records in 
the output instead of combining the segments into a single record.

Why do you use routing code 2 which is designed to alert the operator to a 
change in system status for what amounts to an internal problem in your job?

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of 
Hunt, Bruce
Sent: Tuesday, March 15, 2011 2:38 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: Trouble Reading a Spanned File with an Assembler Program - Working 
Program

Thanks again for everyone's help. If anyone cares, here is the assembler 
program that reads the spanned file and creates a fixed length 136 byte file 
padded with blanks where necessary. I don't claim to be the best assembler 
programmer. I hope that worked in my favor in keeping it simple. But I am 
definitely up for constructive criticism.

I am including the JCL and 2 more programs (a cobol and a rexx). This is the 
reason I took so long to get back with this. Sorry if this is too much 
information.

=======================================================================================
         TITLE 'XP1000'
*
* 02/25/11  B HUNT   CHANGED A SPANNED FILE TO A FIXED FILE
*
XP1000   AMODE 24
XP1000   RMODE 24
XP1000   START
         COPY  EQUATES
         SAVE  (14,12)                 SAVE REGISTERS 14 THRU 12
         BASR  BASE1,0                 ESTABLISH ADDRESSABILITY
         USING *,BASE1                 PROVIDE BASE ID
         ST    RD,SAVEAREA+4           STORE PREV REG 13 IN SAVEAREA +4
         LA    RD,SAVEAREA             LOAD SAVEREA IN REG 13
         B     BEGIN
         SPACE 1
         DS    0D
         DC    CL8'XP1000'
         DC    CL8'&SYSDATE'
         DC    CL8'&SYSTIME'
         SPACE 1
BEGIN    DS    0H
         USING DATA,R8                 ASSOCIATE DATA WITH REG 8
         OPEN  (INFILE,(INPUT),OUTFILE,(OUTPUT))     OPEN FILES
         LTR   RF,RF                   CHECK FOR GOOD OPEN
         BNZ   BADOPEN                 IF BAD OPEN BRANCH TO BADOPEN
LOOP     DS    0H                      PROCESS LOOP
         GET   INFILE                  READ INPUT FILE
         LR    R8,R1                   LOAD INPUT ADDRESS IN REG 8
         XC    FWLEN,FWLEN             SET FULL WORD LENGTH TO ZERO
         MVC   HWLEN,DATA              GET THE RECORD LENGTH FROM DATA
         MVI   FWLEN,C' '              USE A BLANK TO PAD OUTREC-MVCL
         L     R9,FWLEN                LOAD THE INPUT LENGTH IN REG 9
         LA    R6,BATA                 LOAD THE OUTPUT ADDRESS IN REG 6
         LA    R7,136                  LOAD THE OUT LENGTH IN REG 7
         MVCL  R6,R8                   MOVE DATA TO BATA W/ BLANK PAD
WRITE    DS    0H
         PUT   OUTFILE,OUTREC          WRITE OUTREC
         B     LOOP
FINAL    DS    0H
         CLOSE (INFILE,,OUTFILE)
         B     C100
BADOPEN  WTO   ' UABLE TO OPEN FILE',ROUTCDE=(2),DESC=(7)
         B     C100
BADREAD  WTO   ' READ UNSUCCESSFUL ',ROUTCDE=(2),DESC=(7)
         B     C100
BADSEG   WTO   ' SEGMENTS NOT SEQUENTIAL ',ROUTCDE=(2),DESC=(7)
         B     C100
BADWRITE WTO   ' WRITE UNSUCCESSFUL ',ROUTCDE=(2),DESC=(7)
         B     C100
C100     DS    0H
         L     RD,SAVEAREA+4
         RETURN (14,12)                RESTORE REGISTERS AND RETURN
INFILE   DCB   DSORG=PS,RECFM=VBS,MACRF=GL,                            +
               DDNAME=INDD,EODAD=FINAL
OUTFILE  DCB   DSORG=PS,RECFM=FB,LRECL=136,MACRF=PM,                   +
               DDNAME=OUTDD
OUTREC   DS    0CL136
BATA     DS    CL136
SAVEAREA DS    18F
FWLEN    DS    0F
         DS    H
HWLEN    DS    H
         LTORG
INREC    DSECT
DATA     DS    CL136
         DS    CL32000
         DS    CL32000
         DS    CL32000
         END   XP1000

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to