Page 1 of 2

Open/Close/DCB

PostPosted: Fri Oct 28, 2011 9:14 am
by RISCCISCInstSet
In this assembly code, I'm trying to understand what I'm doing wrong with the open/close options and the DCB's. Can you tell me what I'm doing wrong and how to fix it?

:arrow: (The code is mainframe assembler but is based on the z390 emulator.)

         TITLE 'PROGRAM 4 80/80 LISTING'
         PRINT NOGEN
COPY     SUBENTRY
         WTO   'PROG4 COPY INFILE (ASCII) TO OUTFILE (ASCII)'
         OPEN  (DATAIN,INPUT,INFILE,OUTFILE)
         OPEN  (SUMMARY,OUTPUT)
         WTO   'Files opened successfully'
*
LOOP     EQU   *
         GET   INFILE,IRECORD
         MVC   ORECORD,=CL133' '
         MVC   ORECORD(80),IRECORD
         PUT   OUTFILE,ORECORD
         B     LOOP
*
EOF      EQU   *
         CLOSE (INFILE,,OUTFILE)
         WTO   'PROG4 ENDED OK'
         SUBEXIT
ENDDATA  DS    0H 
         CLOSE  (DATAIN,,SUMMARY) 
         SUBEXIT 
INFILE   DCB   DDNAME=INFILE,                                          X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               LRECL=80,                                               X
               EODAD=EOF,                                              X
               MACRF=GM
*
OUTFILE  DCB   DDNAME=OUTFILE,                                         X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               LRECL=133,                                              X
               MACRF=PM
*
DATAIN   DCB   DDNAME=INPUT,                                           X
               DSORG=PS,                                               X
               EODAD=ENDDATA,                                      Â    X
               LRECL=80,                                               X
               RECFM=FT,                                               X
               MACRF=GM 
SUMMARY  DCB   DDNAME=OUTPUT,                                          X
               BLKSIZE=130,                              Â              X
               LRECL=13,                                               X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               MACRF=PM 
IRECORD  DC    CL80' '
ORECORD  DC    CL133' '
         END COPY

Re: Open/Close/DCB

PostPosted: Fri Oct 28, 2011 9:29 am
by enrico-sorichetti
it would be wiser to review the relevant manuals for the proper format of the OPEN macro instruction
here for example
http://publibz.boulder.ibm.com/cgi-bin/ ... 0122165044
not the latest one but more than enough for Your immediate needs
hint ...
         OPEN  (<dcbname>,(INPUT))   
         OPEN  (<dcbname>,(OUTPUT))   

and ....
         WTO   'Files opened successfully'
where did You find the certainty that the files were opened successfully ?

Re: Open/Close/DCB

PostPosted: Fri Oct 28, 2011 9:57 am
by dick scherrer
Hello,

What does the assembly show for the expansion of the OPEN macros?

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 12:22 am
by steve-myers
The operands for OPEN (and CLOSE, for that matter) are in pairs: (<dcbname>,options for that DCB.<dcbname>,options for that DCB,...) If you specify an odd number of operands, the OPEN and CLOSE macros use a default option: INPUT for OPEN, and, eFFectively, nothing for CLOSE, for the last DCB. So, in

OPEN (DATAIN,INPUT,INFILE,OUTFILE)

your first DCB is OK,, but you did not specify a valid option for INFILE. OUTFILE was considered an option, not a DCB name, because it was paired with the INFILE DCB name.

Going to your DCBs. RECFM=FT is valid, but the T option refers to a hardware feature, track overflow, that no longer exists. You are better off not trying to use it. The odds are the input will fail because you did not specify RECFM=FB; most datasets are "blocked," each physical record contains more than one logical record.

Finally, your comments appear to indicate you are translating data from ASCII to EBCDIC, but there is no translation logic in your code.

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 1:07 am
by dick scherrer
Hi Steve,

(The code is mainframe assembler but is based on the z390 emulator.)
The entire exercise may be in ASCII :|

Have a great weekend!

d

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 3:51 am
by RISCCISCInstSet
Update:

         TITLE 'PROGRAM 4 80/80 LISTING'
         PRINT NOGEN
COPY     SUBENTRY
         WTO   'PROG4 COPY INFILE (ASCII) TO OUTFILE (ASCII)'
         OPEN  (INFILE,INPUT)
         OPEN  (OUTFILE,OUTPUT)
         OPEN  (DATAIN,INPUT)
         OPEN  (SUMMARY,OUTPUT)
         WTO   'Files opened successfully'
*
LOOP     EQU   *
         GET   INFILE,IRECORD
         MVC   ORECORD,=CL133' '
         MVC   ORECORD(80),IRECORD
         PUT   OUTFILE,ORECORD
         B     LOOP
*
EOF      EQU   *
               CLOSE (INFILE,,OUTFILE)
               WTO   'PROG4 ENDED OK'
               SUBEXIT
ENDDATA  DS    0H 
              Â CLOSE  (DATAIN,,SUMMARY) 
              Â SUBEXIT 
INFILE   DCB   DDNAME=INFILE,                                          X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               LRECL=80,                                               X
               EODAD=EOF,                                              X
               MACRF=GM
*
OUTFILE  DCB   DDNAME=OUTFILE,                                         X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               LRECL=133,                                              X
               MACRF=PM
*
DATAIN   DCB   DDNAME=INPUT,                                           X
               DSORG=PS,                                               X
               EODAD=ENDDATA,                                      Â    X
               LRECL=80,                                               X
               RECFM=FT,                                               X
               MACRF=GM 
SUMMARY  DCB   DDNAME=OUTPUT,                                          X
               BLKSIZE=130,                              Â              X
               LRECL=13,                                               X
               DSORG=PS,                                               X
               RECFM=FT,                                               X
               MACRF=PM 
IRECORD  DC    CL80' '
ORECORD  DC    CL133' '
         END COPY


17:20:16 COPY      MZ390 START USING z390 V1.5.05 ON J2SE 1.6.0_29 10/28/11
17:20:16 COPY      MZ390 MZ390E error  11       (1/39)39 continuation line < 16 characters -                DSORG=PS,                                               X
17:20:16 COPY      MZ390 MZ390E error  11       (1/41)41 continuation line < 16 characters -                LRECL=80,                                               X
17:20:16 COPY      MZ390 MZ390E error  11       (1/43)43 continuation line < 16 characters -                MACRF=GM 
17:20:16 COPY      MZ390 MZ390E error  11       (1/45)45 continuation line < 16 characters -                BLKSIZE=130,                              Â              X
17:20:16 COPY      MZ390 MZ390E error  11       (1/47)47 continuation line < 16 characters -                DSORG=PS,                                               X
17:20:16 COPY      MZ390 MZ390E error  11       (1/49)49 continuation line < 16 characters -                MACRF=PM 
17:20:17 COPY      AZ390 AZ390E error  29       (1/7)113            OPEN  (DATAIN,INPUT)
17:20:17 COPY      AZ390 AZ390I ERRSUM missing macro = OPEN 
17:20:17 COPY      AZ390 AZ390E error 198     (5/108)117                          LA     1,SUMMARY
17:20:17 COPY      AZ390 AZ390I symbol not defined SUMMARY
17:20:17 COPY      AZ390 AZ390E error 196      (1/22)172   ENDDATA  DS    0H 
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error 196      (1/23)173   Â              Â CLOSE  (DATAIN,,SUMMARY) 
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error 196      (1/24)174   Â              Â SUBEXIT 
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error  29      (1/39)249   DATAIN   DCB   DDNAME=INPUT,                                                          DSORG=PS,                                               X
17:20:17 COPY      AZ390 AZ390I ERRSUM missing macro =  DCB 
17:20:17 COPY      AZ390 AZ390E error 196      (1/41)252   Â               EODAD=ENDDATA,                                      Â                   LRECL=80,                                               X
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error 196      (1/43)255   Â               RECFM=FT,                                                              MACRF=GM 
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error  29      (1/45)257   SUMMARY  DCB   DDNAME=OUTPUT,                                                         BLKSIZE=130,                              Â              X
17:20:17 COPY      AZ390 AZ390I ERRSUM missing macro = DCB 
17:20:17 COPY      AZ390 AZ390E error 196      (1/47)260   Â               LRECL=13,                                                              DSORG=PS,                                               X
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E error 196      (1/49)263   Â               RECFM=FT,                                                              MACRF=PM 
17:20:17 COPY      AZ390 AZ390I invalid character in opcode -  
17:20:17 COPY      AZ390 AZ390E ERRSUM Critical Error Summary Option
17:20:17 COPY      AZ390 AZ390E ERRSUM Fix and repeat until all nested errors resolved
17:20:17 COPY      AZ390 AZ390E ERRSUM missing macro =OPEN 
17:20:17 COPY      AZ390 AZ390E ERRSUM missing macro = DCB 
17:20:17 COPY      AZ390 AZ390E ERRSUM missing macro =DCB 
17:20:17 COPY      AZ390 AZ390E ERRSUM total missing   copy   files =0
17:20:17 COPY      AZ390 AZ390E ERRSUM total missing   macro  files =3
17:20:17 COPY      AZ390 AZ390E ERRSUM total undefined symbols      =1
17:20:17 COPY      AZ390 AZ390E ERRSUM total mz390 errors    = 6
17:20:17 COPY      AZ390 AZ390E ERRSUM total az390 errors    = 11
17:20:17 COPY      AZ390 AZ390I FID=  1 ERR=  16 c:\Program Files\Automated Software Tools\z390\CS4321\COPY.MLC
17:20:17 COPY      AZ390 AZ390I FID=  5 ERR=   1 c:\PROGRA~1\AUTOMA~1\z390\mac\ZOPEN.MAC
17:20:17 COPY      MZ390 ENDED   RC=12 SEC= 0 MEM(MB)= 47 IO=2443

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 3:54 am
by BillyBoyo
I suggest you post all those Xs back where they came from.

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 4:04 am
by RISCCISCInstSet
@BillyBoyo Are you referring to the continuation line errors? The X's were in column 72 before I pasted them. How do I resolve this type of error?

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 7:47 am
by RISCCISCInstSet
I'm still not sure how to handle the open statement. Can you point out what it is I'm not understanding, or give me a good URL, or location found from the URL, such that I understand how I'm screwing up? :geek:

Thanks

Re: Open/Close/DCB

PostPosted: Sat Oct 29, 2011 10:58 am
by dick scherrer
Hello,

You need to find the documentation for the assembler you are using. Possibly by looking on the z390 site.

I've never used z390, but they may have their own forum for z390 questions.