abend s0c1 on copying files(assembler)



High Level Assembler(HLASM) for MVS & VM & VSE

abend s0c1 on copying files(assembler)

Postby nikki lauda » Tue Oct 22, 2013 3:38 pm

Hello everybody,

I'm trying to write a very small program that just copying a file into an another... The copy works very well but...(yes there's a "but") i always get an s0c1 error:

Here is my source:

P1       START                                                         
         BALR  12,0                                                     
         USING *,12                                                     
*--------------------------------------------                           
         OPEN  (INFILE,(INPUT))                                         
         OPEN  (OUTFILE,(OUTPUT))                                       
LOOP     EQU *                                                         
         GET INFILE,INAREA                                             
         MVC OUTREC,INAREA                                             
         PUT OUTFILE,OUTAREA                                           
         B   LOOP                                                       
ENDDATA  EQU *                                                         
         CLOSE  INFILE                                                 
         CLOSE  OUTFILE                                                 
         L     15,A                                                     
         BR    14                                                       
*--------------------------------------------                           
INAREA   DS CL80                                                       
OUTAREA  DS 0CL80                                                       
OUTREC   DS CL80                                                       
A        DC F'0'                                                       
OUTFIN   DS CL80'==========FIN======='                                 
INFILE   DCB   DDNAME=INER,RECFM=FB,LRECL=80,DSORG=PS,MACRF=GM,        X
               EODAD=ENDDATA                                           
OUTFILE  DCB   DDNAME=OUTER,RECFM=FBA,LRECL=80,                        X
               DSORG=PS,MACRF=PM                                       
         END P1                                                         



here is my job compile (for the link i've tried amode=31 too but i got the same issue):

//RDCPLKB JOB (PL,A4RDMODT),'UNLO-TABLE',MSGCLASS=H,                   
// NOTIFY=&SYSUID,REGION=0M,CLASS=R,                                   
// RESTART=*                                                           
//JOBLIB   DD DSN=PA4.CPG4RC2.LOAD,DISP=SHR                             
/*ROUTE PRINT PR6GESPE                                                 
//*=====================================================================
//STEP2        EXEC PGM=ASMA90,PARM='DECK,XREF(SHORT)'                 
//*--------------------------------------------------------------------
//*                                                                     
//*--------------------------------------------------------------------
//SYSUT1       DD DSN=,UNIT=SYSDA,SPACE=(CYL,13)                       
//SYSUT2       DD DSN=,UNIT=SYSDA,SPACE=(CYL,13)                       
//SYSUT3       DD DSN=,UNIT=SYSDA,SPACE=(CYL,13)                       
//SYSPRINT     DD SYSOUT=*,DCB=BLKSIZE=1331                             
//SYSPUNCH     DD DSN=PAS.CGXPSER.MBDECK(MBTS01),DISP=OLD               
//SYSIN        DD DISP=SHR,DSN=PAS.CGXPSER.MBCOBL(MBTS03)               
//SYSLIN       DD DUMMY                                                 
//SYSLIB       DD DISP=SHR,DSN=SYS1.MACLIB                             
//             DD DISP=SHR,DSN=SYS1.MODGEN                             
//*---------------------------------------------------------------------
//* LINK                                                               
//*---------------------------------------------------------------------
//LINK1        EXEC PGM=IEWL,REGION=512K,                               
//       PARM='XREF,CALL,LIST,LET,SIZE=(512K,64K),AMODE=24'             
//SYSPRINT     DD SYSOUT=*                                             
//SYSUT1       DD UNIT=SYSDA,SPACE=(CYL,05)                             
//SYSLMOD      DD DSN=PA4.CRDMODT.TLOADBA.V001R001,DISP=SHR             
//SYSLIB       DD DSN=SYS1.CEE.SCEELKED,DISP=SHR                       
//             DD DSN=PA4.CRDMODT.TLOADBAT,DISP=SHR                     
//             DD DSN=PA4.CRDMODT.TLOADBA.V001R001,DISP=SHR             
//DECKLIB      DD DSN=PAS.CGXPSER.MBDECK,DISP=SHR                       
//SYSLIN       DD *                                                     
 INCLUDE DECKLIB(MBTS01)                                               
 NAME MBTS01(R)                                                         
/*                                                                     



here is my job execution:

//EXAS01   JOB (PL,ASMGALOT),'UNLO-TABLE',MSGCLASS=H,                   
// NOTIFY=&SYSUID,REGION=0M,CLASS=R,                                   
// RESTART=*                                                           
/*ROUTE PRINT PR6GESPE                                                 
//JOBLIB DD DISP=SHR,DSN=PA4.CRDMODT.TLOADBAT                           
//       DD DISP=SHR,DSN=PA4.CRDMODT.TLOADBA.V001R001                   
//*---------------------------------------------------------------------
//SCRATC01     EXEC PGM=IDCAMS                                         
//SYSPRINT     DD SYSOUT=*                                             
//SYSOUT       DD SYSOUT=*                                             
//SYSIN        DD *                                                     
 DELETE SA4.NRDMODT.TEST.MBE2                                           
 SET MAXCC=0                                                           
/*                                                                     
//BULFACT  EXEC PGM=MBTS01                                             
//SYSPRINT     DD SYSOUT=*                                             
//SYSOUT       DD SYSOUT=*                                             
//INER     DD DSN=SA4.NRDMODT.TEST.MBE,DISP=SHR                         
//OUTER    DD DSN=SA4.NRDMODT.TEST.MBE2,                   
//            DISP=(,CATLG),                               
//            SPACE=(TRK,(1,1),RLSE),                     
//            RECFM=FBA,LRECL=80                           
                                         
//*                                                                     




As you can see every thing seems simple but i don't understand why i still have an s0c1....
i also tried to just open and put one record in the outfile output (without reading the input file with loop) an i got an s322 abend like it's looping or waiting something.

If someone can help me to understand and resolve this mystery it'll be great.

Thanks in advance.

Nikki Lauda.
nikki lauda
 
Posts: 5
Joined: Tue Mar 26, 2013 9:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend s0c1 on copying files(assembler)

Postby steve-myers » Tue Oct 22, 2013 4:39 pm

Your little program is failing because register 14, at the end, points to goodness knows where.

Assembler programs have a prolog where your program saves registers in a save area the caller provides and provides a new save area for use by any programs your program calls, which is what the GET and PUT macros are doing, and an epilog where the program restores the registers from the save area before it executes the BR 14.

A complete working copy program, with a prolog and epilog, follows.
MICROCPY CSECT
         USING *,12
         SAVE  (14,12),,*
         LR    12,15
         LA    15,SAVEAREA
         ST    15,8(,13)
         ST    13,4(,15)
         LR    13,15
         OPEN  (INDCB,INPUT,OUTDCB,OUTPUT)
LOOP     GET   INDCB
         LR    0,1
         PUT   OUTDCB,(0)
         B     LOOP
EOF      CLOSE (INDCB,,OUTDCB)
         L     13,4(,13)
         RETURN (14,12),T,RC=0
SAVEAREA DC    18F'0'
INDCB    DCB   DSORG=PS,MACRF=GL,DDNAME=INPUT,EODAD=EOF
OUTDCB   DCB   DSORG=PS,MACRF=PM,DDNAME=OUTPUT
         END   MICROCPY
The complete prolog is -

MICROCPY CSECT
USING *,12
SAVE (14,12),,*
LR 12,15
LA 15,SAVEAREA
ST 15,8(,13)
ST 13,4(,15)
LR 13,15

The complete epilog is

L 13,4(,13)
RETURN (14,12),T,RC=0

The SAVE macro - a standard IBM macro - saves the registers. LA 15,SAVEAREA through LR 13,15 prepares a new register save area. The save areas are supposed to be in a linked list, which is what the two ST instructions after the LA instruction are doing for the new save area.

The L instruction in the epilog uses this linked list to load the address of the register save area provided by the caller; the RETURN macro - another standard IBM macro - restores the registers, places a return code into register 15, and includes the BR 14 instruction to actually return to the program that called your program. The T in the RETURN macro places a very subtle flag in your save area that its contents are no longer valid.

MACRF=GL in the DCB for the input data set tells the subroutine the GET macro calls to simply return the address of the input record in an input buffer in register 1 rather than copy the record to a data area in your program; the effect here is the GET macro locates input data, and the PUT macro copies the data directly from the input buffer to the output buffer. Data copying is slow; your program copies the data twice: the GET macro copies the data to a data area in your program, and the PUT macro copies the data from your program to the output buffer.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: abend s0c1 on copying files(assembler)

Postby steve-myers » Tue Oct 22, 2013 11:43 pm

nikki lauda wrote:... here is my job compile (for the link i've tried amode=31 too but i got the same issue): ...
For a simple module like yours, the best way too set AMODE 31 is by defining it in your program:

XYZ CSECT
XYZ AMODE 31

When the Binder detects the entry point is in an AMODE 31 module it will set the load module's entry point to AMODE 31.

RMODE 31 or RMODE ANY, on the other hand, represents a problem. The DCB (and a buch of related data areas) when actually used must be located below the 16 meg line. The topic DCB and APF Authorized discusses this issue in more detail. Macros like GET and PUT work perfectly OK when they are located above the line, as do macros like OPEN and CLOSE, though they cannot have an inline parameter list like the OPEN and CLOSE macros in your program, but the DCB must be located below the line. The original poster of the DCB and APF Authorized topic had an RMODE ANY program that ultimately failed not because of its storage location but because of what amounted to an unforseen programming error. I had something similar happen to me back in the 1980s, so I was able to correctly deduce the real problem

These users thanked the author steve-myers for the post:
Peter_Mann (Wed Oct 23, 2013 12:12 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: abend s0c1 on copying files(assembler)

Postby nikki lauda » Wed Oct 23, 2013 2:30 pm

Hello steve-myers,

Thank you very much for your answers that help me to get my program works and mostly understand how it works and how handle registers and save areas !!!

Thank you also for your explanation about the rmode=31 issue.


Bye.
nikki lauda
 
Posts: 5
Joined: Tue Mar 26, 2013 9:37 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post