assemblyjcl

How to correctly declare DCB in JCL/assembler for QSAM put-locate


I'm trying to write a program that will write some data to a temporary dataset using the 370/assembler and QSAM. I get a soc01 when executing the put.

My DCB declaration in the assembler code looks like this:

TEMPFILE DCB   DDNAME=TEMP,                                            X
               DEVD=DA,                                                X
               DSORG=PS,                                               X
               MACRF=PL,GL,                                            X
               RECFM=FBA,                                              X
               LRECL=25,                                               X
               BLKSIZE=3000,                                           X
               EODAD=EOF3

In the JCL, the declaration looks like this:

//TEMP     DD DSN=&&TEMP,UNIT=PUB,DISP=(MOD,KEEP,DELETE),
//            DCB=(LRECL=25,BLKSIZE=3000)

And the put command looks like this:

         PUT    TEMPFILE                                                
         MVC    0(25,1),HIGHSALE

I suspect that the problem lies within my JCL declaration, but i'm not having any luck finding anything.


Solution

  • You're getting a S0C4, i.e., you're trying to access storage that doesn't belong to you. Presuming that you've already determined (from the PSW or via some other means) that the abending instructing is in some of the code your PUT macro expands out to, and that you have no messages in your assembly listing indicating "no active using for...", where does register 1 point to? Since you're using locate mode, register 1 must point to your data.

    Just as a side note, I don't normally see block size coded in a DCB macro in a program. Most shops are using system determined block size and thus you never see it in either the program or the JCL. It doesn't hurt anything if you're more comfortable coding it.