Page 1 of 1

Sending Data, Fixing Problems

PostPosted: Sun Nov 25, 2012 12:13 pm
by RISCCISCInstSet
This code is from a school powerpoint presentation from my class and I need to correctly make sense of it to help me complete a lab. My question here is: how do I tell the system about all the variables?

COPY  SETUP
      OPEN    (SYSUT1,PARM)
      LA      2,SYSUT1
      USING   IHADCB,2
      LH      3,DCBLRECL
      LA      2,SYSUT2
      STH     3,DCBLRECL
      LHI     4,27998
      SRDA    4,32
      DR      4,3
      MR      4,3
      STH     5,DCBBLKSI
      OPEN    (SYSUT2,OUTPUT)
      DCBD
SYSUT1   DCB   DDNAME=SYSUT1,                                          X
               DSORG=PS,                                               X
               MACRF=GM,                                               X
               RECFM=FB   

SYSUT2   DCB   DDNAME=SYSUT2,                                          X
               DSORG=PS,                                               X
               MACRF=PM,                                               X
               RECFM=FB
    END

Re: Sending Data, Fixing Problems

PostPosted: Sun Nov 25, 2012 1:59 pm
by BillyBoyo
I'm not sure what you mean? Just like in any other program?

Re: Sending Data, Fixing Problems

PostPosted: Sun Nov 25, 2012 9:21 pm
by steve-myers
I see several direct problems, and a conceptual problem

COPY SETUP

I presume SETUP is a system defined MACRO. It is non standard; we cannot help you.

OPEN (SYSUT1,PARM)

One would specify a valid option in the OPEN macro. I'm reasonably certain that PARM is not a valid option.

LH 3,DCBLRECL
LA 2,SYSUT2
STH 3,DCBLRECL
LHI 4,27998
SRDA 4,32
DR 4,3
MR 4,3
STH 5,DCBBLKSI

What you're trying to do is valid, but ...
  • You should not replace DCBBLKSI if it is already specified.
  • At least in concept. the BLKSIZE you have chosen is dependent on the device geometry of the 3390; your idea may not produce satisfactory results on any other device. I grant the odds of finding anything other than 3390 in the wild are slim, to say the least, but it is something you should consider.
  • This is a nothing point, but ... record lengths and logical record lengths are always positive values. Most programmers do something like

    SR 4,4
    LHI 5,27998
    DR 4,3

    What you are doing is assuming 27998 could be negative.
  • There is nothing after the second OPEN macro.
  • You specify MACRF=GM in your SYSUT1 DCB. This means you must supply a buffer in your program for input records. This is kind of slow, but that's OK. The real problem is you allow the input LRECL to be variable, which means your buffer length should be variable, or at least larger than the largest LRECL you will encounter. Since the input LRECL is not fixed, you should consider the use of "locate" mode processing and specify MACRF=GL. When you use "locate" mode for input, the GET macro returns the address of input records in the input I/O buffer; you do not have to specify any storage in your program. Your PUT macro will specify the address of the record in the input buffer. Your copy loop becomes

    COPYLOOP GET SYSUT1
    LR 2,1
    PUT SYSUT2,(2)
    B COPYLOOP

    The LR after the GET macro copies the address of the record in the input I/O buffer to register 2; The PUT macro uses this address.You must get the address out of register 1 before you issue the PUT; the PUT macro uses register 1 before it does anything about the record.
  • Your SYSUT1 DCB does not specify an end of data routine.
DCBD
SYSUT1 DCB DDNAME=SYSUT1,
DSORG=PS,
MACRF=GM,
RECFM=FB
  • The DCBD macro defines the IHADCB DSECT, but the asssembly is still in the DSECT after the DCBD macro finishes. The DCBs become part of the IHADCB DSECT, not part of your program. You should place the DCBD macro at the end of your program.
  • I believe the DCBD macro has to be told what kind of DCB it is mapping.

Re: Sending Data, Fixing Problems

PostPosted: Mon Nov 26, 2012 8:07 am
by RISCCISCInstSet
Thanks for your help. Updated code:

COPY  SETUP
      OPEN    (SYSUT1,INPUT)
      OPEN    (SYSUT2,OUTPUT)
      LA      2,SYSUT1
      USING   IHADCB,2
      LH      3,DCBLRECL
      LA      2,SYSUT2
      STH     3,DCBLRECL
      LHI     4,27998
      SRDA    4,32
      DR      4,3
      MR      4,3
      STH     5,DCBBLKSI
SYSUT1   DCB   DDNAME=INPUT,                                          X
               DSORG=PS,                                               X
               MACRF=GL,                                               X
               RECFM=FB,                                               X
               EODAD=EOF
SYSUT2   DCB   DDNAME=OUTPUT,                                          X
               DSORG=PS,                                               X
               MACRF=PM,                                               X
               RECFM=FB
    DCBD DSORG=PS
    END

Still working on this - I may have more to discuss later.

Re: Sending Data, Fixing Problems

PostPosted: Mon Nov 26, 2012 9:48 am
by steve-myers
Yes you do. You do not open SYSUT2 until DCBLRECL and DCBBLKSI have values, and you still do not have any code to do the copy. I noticed you have fixed the DCBD macro call to provide the data areas you will need.