IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Passing parm from JCL to Assembler, but probably edit issue


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lloyd Christensen

New User


Joined: 26 Apr 2022
Posts: 9
Location: United States

PostPosted: Sat May 28, 2022 10:05 pm
Reply with quote

I have been taking an online Assembler course. I have an excellent instructor who has been dealing with a catastrophic health issue and has limited availability. All failure to comprehend are mine, not his.

have reviewed an older thread on this. I understand that R1 will hold the parameter and that the first two bytes hold the length of the parameter.

I am encountering two problems. It's possible that both are more of an output and formatting issue. The first certainly is.

I am using R10 to hold the address of the parm and R9 for the length of the parm.

You may notice a commented out "DS X'0000'" used to force a S0C1 abend so that I can display registers in the dump. I've used that, and R9 holds a '3' and R10 holds what I believe to be an address. So that's commented out here. I get a clean (RC=0, anyway) run.

I have an output file (FILEOUT) into which I want to write the length of the parameter and then the parameter value. The output isn't viewable. If in SDSF I do SET HEX ON then I see the length as 3C which is what I'd expect but I don't get a printable '3'. For debugging, I have a couple of PUTs that aren't meant to be in the final result.

And I don't see anything but garbage in the rest of the output record. In my first run I am passing JCL PARM='THE' so the length is 3. I want to see a the word 'THE' and otherwise blanks to the right of the 'E'.



Code:
         PRINT ON,NODATA,NOGEN                                       
* ------------------------------------------------------------------*
*                                                                   *
APGM5    CSECT ,           COMMA REQUIRED IF COMMENT ON THIS STMT     
         SAVE  (14,12)                SAVE CALLER'S REGS             
         BASR  R12,0                  ESTABLISH                       
         USING *,R12                                                 
*        LA    R11,2048                                               
*        LA    R11,2048(R12,R11)                                     
* ------------------------------------------------------------------*
* SAVE CALLER REGISTERS                                             *
         LA    R2,SAVEAREA            POINT TO MY LOWER-LEVEL SA     
         ST    R2,8(,R13)             FORWARD-CHAIN MINE FROM CALLER'S
         ST    R13,SAVEAREA+4         BACK-CHAIN CALLER'S FROM MINE   
         LR    R13,R2                 SET 13 FOR MY SUBROUTINE CALLS 
                                                                     
* ------------------------------------------------------------------*
*                                                                   *
* PROGRAM LOGIC                                                     *
* THE CONTENTS OF THE PARM PASSED VIA JCL ARE PLACED IN R1.         *
*     THE FIRST 2 BYTES (HALF-WORD) PROVIDE THE PARM LENGTH.        *
* LOAD R1 INTO R10         SAVE IT SO IT ISN'T OVERLAID.            *
* REG10   IS USED TO STORE THE ENTIRE PARM PASSED FROM JCL.         *
* REG9    IS USED TO STORE THE LENGTH OF THE PARM.                  *
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .

* ------------------------------------------------------------------*
* *
* GET STARTED *
STRTUP EQU *
*
L R10,0(R1) LOAD R10 WITH THE FULL PARM
* DO SO BEFORE OPEN AS OPEN WIPES R1
SR R9,R9 ZERO R9
LH R9,0(,R10) LOAD R9 WITH THE LENGTH OF THE PARM
LA R10,2(,R10) LOAD ADDRESS OF PARM'S FIRST BYTE
* DS X'0000' FORCE ABEND
OPEN (FILEOUT,(OUTPUT))
*
* VERIFY A PARM IS PASSED
LTR R9,R9
BZ NOPARM IF LENGTH IS 0 THEN BR TO NOPARM
* -----------------------------------------------------------*
MVC OUTREC,=CL133' ' MOVE SPACES TO OUTPUT RECORD
CVD R9,PARMLEN CONVERT PARM LENGTH TO PACKED DEC
PUT FILEOUT,PARMLEN
ZAP UNPKLEN,PARMLEN UNPACK PARM LENGTH
PUT FILEOUT,UNPKLEN
MVC LENPARM,EDLEN
ED LENPARM,UNPKLEN
MVC PARMOUT,R10 MOVE R10
PUT FILEOUT,OUTREC
B WRAPUP
* -----------------------------------------------------------*
NOPARM EQU *
MVC OUTREC,=CL133' ' MOVE SPACES TO OUTPUT RECORD
MVC PARMFLD,=CL100'NO PARAMETER SUPPLIED'
PUT FILEOUT,OUTREC
Code:

*        -----------------------------------------------------------*   
WRAPUP   EQU   *                                                       
         L     R13,SAVEAREA+4         POINT TO CALLER'S SAVE AREA       
         RETURN (14,12),RC=0          RESTORE CALLER'S REGS & RETURN   
SAVEAREA DC    18F'0'     AREA FOR MY CALLEE TO SAVE & RESTORE MY REGS 
* ------------------------------------------------------------------*   
*                       DATA AREAS                                   * 
*                                                                       
         DS    F                                                       
PARMLEN  DS    D                                                       
UNPKLEN  DS    PL5                                                     
PARMFLD  DS    CL100                                                   
*                                                                       
* ------------------------------------------------------------------*   
* DEFINE EDITWORD                                                       
*               1 2 3 4 5 6                                             
EDLEN     DC  X'402020202021'               3 DIGITS, NO DEC           
*                                                                       
* ------------------------------------------------------------------*   
FILEOUT  DCB   DSORG=PS,                                               X
               MACRF=(PM),                                             X
               DEVD=DA,                                                X
               DDNAME=FILEOUT,                                         X
               RECFM=FB,                                               X
               LRECL=133                                               
*                                                                       
OUTREC   DS   0CL133                                                   
         DC    CL5' '                                                   
LENPARM  DS    ZL6                                                     
         DC    CL5' '                                                   
PARMOUT  DS    CL100                                                   
         DC    CL17' '                                                 
**********************  WRAP IT UP   ********************************* 
LTORG
YREGS
END
//L.SYSLMOD DD DSN=KC03I71.ASM.LOAD,DISP=SHR
//L.SYSLIB DD DSN=KC03I71.ASM.LOAD,DISP=SHR
//L.SYSIN DD *
NAME JCLCONC1(R)
/*


Output screen shot, with HEX ON, looks like this:


---------------------------------------------------------------------------

0000000300000000000000000000000000000000000000000000000000000000000000000000
0000000C00000000000000000000000000000000000000000000000000000000000000000000
---------------------------------------------------------------------------

0000300000000000000000000000000000000000000000000000000000000000000000000000
0000C00000000000000000000000000000000000000000000000000000000000000000000000
---------------------------------------------------------------------------
< " 0 " 0 " 0 " 0 " 0 " 0 " 0 " 0
44444444444444440000000F4100007FF07FF07FF07FF07FF07FF0000000007FF07FF0000000
00000000000000000000000DC80000FF00FF00FF00FF00FF00FF0000000000FF00FF00000000

Point of the above is I have a couple of PUT statements that show that the parameter length is 3

My JCL is pretty simple:


So I have two questions:
1) What am I doing wrong with the output/formatting of the length?
2) What am I doing wrong with getting the full parameter?
Code:

//JOBLIB   DD   DSN=KC03I71.ASM.LOAD,DISP=SHR
//STEP1    EXEC PGM=JCLCONC1,PARM='/THE'     
//FILEOUT  DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSUDUMP DD SYSOUT=*,OUTLIM=5000           
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 724
Location: Denmark

PostPosted: Sun May 29, 2022 2:59 pm
Reply with quote

Your problem is with handling of binary-to-zoned decimals.
This works..
Program call:
//GO EXEC PGM=TESTPGM,PARM='Kilroy was here'
Code:
         l     r10,0(r1)                                             
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 4 Line(s) not
         lh    r9,0(r10)               get length                     
         cvd   r9,dw                   length as packed decimal       
         mvc   prtr(7),=c'length='                                   
         unpk  prtr+7(4),dw            unpack to zoned decimal       
         oi    prtr+7+4-1,x'f0'        make last digit readable       
         mvc   prtr+12(5),=c'text='                                   
         bctr  r9,0                    machine length for execute     
         j     *+10                    jump to execute               
         mvc   prtr+17(*-*),2(r10)     model for copy text           
         ex    r9,*-6                  copy text                     
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   13 Line(s) not
prtr     dc    cl140' '                                               
dw       ds    d                                                       

Output:
length=0015 text=Kilroy was here

The length in this case is 15, so the CVD will store x'000000000000015C' in the dw field.
The UNPK will store x'F0F0F1C5', note the sign nibble in the last byte, which is why you need the OI instrunction to make it readable.
And no need to clear the register before a LH, the LH will do that anyway.
Back to top
View user's profile Send private message
Lloyd Christensen

New User


Joined: 26 Apr 2022
Posts: 9
Location: United States

PostPosted: Sun May 29, 2022 8:10 pm
Reply with quote

Thank you
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts How to Login in to cics region and is... CICS 7
No new posts System add a USER parm when job submi... TSO/ISPF 4
No new posts Passing containers on START command CICS 4
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top