How to store and retain values in JCL



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to store and retain values in JCL

Postby nikesh_rai » Tue Jan 22, 2013 3:55 pm

Hi,

I have a requierment where I have to insert a filler in cobol copybook using JCL. the filler should be inserted after each field with the same level number.
for example the input copybook is like this:

21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
      PIC X(20).                                   
 21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL 
      PIC 9(10)V9(8).                             
 21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL   
      PIC X(10).                                   
 21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL   
      PIC X(8).                                   
 12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .         
 12 W541-SLS-TAX-AMT    PIC Z(8)V9(4).             
 12 W541-SLS-TAX-RBT-APPL PIC X        .           


and after inserting the filler, the ouput should be:

21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
      PIC X(20).                                   
 21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL 
      PIC 9(10)V9(8).                             
 21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL   
      PIC X(10).                                   
 21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL   
      PIC X(8).                                   
 12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .         
 12 FILLER     PIC Z(01).                         
 12 W541-SLS-TAX-AMT    PIC Z(8)V9(4).             
 12 FILLER     PIC Z(01).                         
 12 W541-SLS-TAX-RBT-APPL PIC X        .         


but my problem is how i will identify the filed where i have to insert filler.. since i can identify the fileds with level number, pic clause and '.', however the incase of declearation like this:

21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
      PIC X(20).                                   


Where PIC is coming in the second line, I am not able to aply the above logic
identify the fileds with level number, pic clause and '.'
..

For this type of scenario i need to store the value read in first line to get the level number, then check the next line for PIC and '.', and then insert the filler with same level number.

In copybooks, all the fields will come either in single line or in double line with PIC and '.' in 2nd line.

For Single line, i don't have any issue, but for the double line I am facing the problem.
Can anyone please suggest me, if i can store the previous value in some temp veriable and then retain it.. or please suggest me some better idea..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: How to store and retain values in JCL

 

Re: How to store and retain values in JCL

Postby BillyBoyo » Tue Jan 22, 2013 4:31 pm

Can you show the "JCL" that you are using?

Are you sure you want to insert FILLER in between REDEFINES anyway? Have you tried "doing that by hand" and compiling the code?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to store and retain values in JCL

Postby nikesh_rai » Tue Jan 22, 2013 6:45 pm

Thanks Billy,

I tried inserting the fillers manually between REDEFINES and compiled the code, its working fine.. so no issue with that..

000011 //SYSIN    DD *                                                       
000012   OPTION COPY                                                         
000013   OUTFIL IFTHEN=(WHEN=(1,80,SS,EQ,C'01 ',AND,1,80,SS,EQ,C'PIC ',AND,   
000014                        1,80,SS,EQ,C'.'),                               
000015          BUILD=(1,80,/,C'       01 FILLER     PIC Z(01).')),           
000016          IFTHEN=(WHEN=(1,80,SS,EQ,C'02 ',AND,1,80,SS,EQ,C'PIC ',AND,   
000017                        1,80,SS,EQ,C'.'),                               
000018          BUILD=(1,80,/,C'       02 FILLER     PIC Z(01).')),           
000019          IFTHEN=(WHEN=(1,80,SS,EQ,C'03 ',AND,1,80,SS,EQ,C'PIC ',AND,   
000020                        1,80,SS,EQ,C'.'),                               
000021          BUILD=(1,80,/,C'       03 FILLER     PIC Z(01).')),           


i repeated it till 49th level..( I didn't have other options ).. One more thing.. copybooks will not have any 88 or 66 level.. so no issues with these levels as well

when i executed the above JCL..result is coming like this..:

 18 W541-DTRMNT-CD      PIC X(4)       .                 
 18 FILLER     PIC Z(01).                                 
 18 W541-DTRMNT-REDEFN.                                   
 21 W541-DTRMNT-VAL     PIC X(20)      .                 
 21 FILLER     PIC Z(01).                                 
 21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL       
      PIC X(20).                                         
 21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL         
      PIC 9(10)V9(8).                                     
 21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL         
      PIC X(10).                                         
 21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL         
      PIC X(8).                                           
 12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .               
 12 FILLER     PIC Z(01).                                 
 12 W541-SLS-TAX-AMT    PIC Z(8)V9(4).                   
 12 FILLER     PIC Z(01).                                 
 12 W541-SLS-TAX-RBT-APPL PIC X        .                 
 12 FILLER     PIC Z(01).                                 
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: How to store and retain values in JCL

Postby BillyBoyo » Tue Jan 22, 2013 7:02 pm

What compiler are you using? I get s-levels. Even if it compiles with yours, is that the effect that you want, an extra byte for each field even if it is a REDEFINES?

If you can be explicit about what you want, there may be better suggestions than what you are attempting. You can "get around" one problem, but there will be others.

If you want to "get around" this one, you're going to have to look at WHEN=GROUP with PUSH.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How to store and retain values in JCL

Postby nikesh_rai » Tue Jan 22, 2013 7:23 pm

Thanks Billy,

the Filler will be inserted only after the fields which are not group headers.. The REDEFINE fields what you can see here, are not group headers and it is ok. In case of group headers, Fillers will not be inserted and looks like these:

02 W541-WK-STRG-BIT-REC.                               
03 W541-VAR-REC-LEN             PIC Z(4)      .         
03 FILLER     PIC Z(01).                               
03 W541-BIT-REC.                                       
06 W541-BIT-STRD-INFO.                                 
09 W541-BIT-ID.                                         
12 W541-USG-BIT-ID.                                     
15 W541-EVENT-ID.                                       
18 W541-EVENT-FILE-INSTNC PIC X(8)    .                 
18 FILLER     PIC Z(01).                               
18 W541-EVENT-REC-SEQ-NBR PIC 9(8)    .                 
18 FILLER     PIC Z(01).                               
15 W541-BIT-SEQ-NBR    PIC Z(4).                       
15 FILLER     PIC Z(01).                               
12 W541-CPI-BIT-ID REDEFINES W541-USG-BIT-ID.           
15 W541-CPI-ID         PIC Z(10)  .


this part is also working fine..:),

however, i will try with WHEN=GROUP with PUSH.. but I am not aware of this option.. can you please provide me some links for better understanding.. I will also google for this option..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: How to store and retain values in JCL

Postby nikesh_rai » Tue Jan 22, 2013 7:41 pm

Billy.. I got a good manual and it have all the details about WHEN=GROUP option.. i will go through it.. and will check and let you know the results..
and thanks a lot for your help.. :)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: How to store and retain values in JCL

Postby NicC » Wed Jan 23, 2013 2:09 am

This seems to have nothing to do with JCL - the only JCL statement shown is
//SYSIN DD *
. It looks more like a sort question - I am assuming DFSort so I will move it there but if it is SYNCSORT I will move it there.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: How to store and retain values in JCL

Postby nikesh_rai » Wed Jan 23, 2013 11:50 am

Hey Billy..

I tried with the WHEN=GROUP, but Build or Overlay is not compatible with WHEN=GROUP option.. I can put condition with GROUP but can not perform anything if condition is true, since Build or Overlay is not available with WHEN=GROUP.

however, I have succeeded to replace that 49 build statement for inserting FILLERS for each level with PARSE

OUTFIL IFTHEN=(WHEN=(8,2,FS,EQ,NUM,AND,10,1,CH,EQ,C' ',AND,         
                     1,80,SS,EQ,C'PIC ',AND,1,80,SS,EQ,C'.'),       
             PARSE=(%01=(STARTAT=NONBLANK,ENDBEFR=BLANKS,FIXLEN=2)),
             BUILD=(1,80,/,1:C'       ',8:%01,                     
                    11:C'FILLER      PIC Z(01).'))                 


but my still persist.. i couldn't insert the fillers after REDEFINES result still coming as:

 15 W541-DTRMNT-RATE-KEY OCCURS 10 TIMES                   
      INDEXED BY W541-DTRMNT-INDX .                       
 18 W541-DTRMNT-CD      PIC X(4)       .                   
 18 FILLER      PIC Z(01).                                 
 18 W541-DTRMNT-REDEFN.                                   
 21 W541-DTRMNT-VAL     PIC X(20)      .                   
 21 FILLER      PIC Z(01).                                 
 21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL         
      PIC X(20).                                           
 21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL         
      PIC 9(10)V9(8).                                     
 21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL           
      PIC X(10).                                           
 21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL           
      PIC X(8).                                           
 12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .                 
 12 FILLER      PIC Z(01).                                 
 12 W541-SLS-TAX-AMT    PIC Z(8)V9(4).                     
 12 FILLER      PIC Z(01).                                 
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: How to store and retain values in JCL

Postby bodatrinadh » Wed Jan 23, 2013 1:22 pm

Hi Nikesh,

Try this code...

//STEP1   EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN   DD *   
       15 W541-DTRMNT-RATE-KEY OCCURS 10 TIMES
              INDEXED BY W541-DTRMNT-INDX .
       18 W541-DTRMNT-CD      PIC X(4)       .
       18 W541-DTRMNT-REDEFN.
       21 W541-DTRMNT-VAL     PIC X(20)
       21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(20).                               
       21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
           PIC 9(10)V9(8).                           
       21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(10).                                   
       21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(8).                           
       12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .
       12 W541-SLS-TAX-AMT        PIC Z(8)V9(4).
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *     
 OPTION COPY   
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'REDEFINES'),
                          END=(1,80,SS,EQ,C'PIC',&,1,80,SS,EQ,C'.'),
       PUSH=(81:8,2,83:SEQ=4))
                                               
 OUTFIL IFTHEN=(WHEN=(83,4,ZD,EQ,+2),
            BUILD=(1,80,/,1:7X,8:81,2,X,11:C'FILLER      PIC Z(01).')),
                                                   
        IFTHEN=(WHEN=(8,2,FS,EQ,NUM,AND,10,1,CH,EQ,C' ',AND,
                      1,80,SS,EQ,C'PIC ',AND,1,80,SS,EQ,C'.'),
          PARSE=(%01=(STARTAT=NONBLANK,ENDBEFR=BLANKS,FIXLEN=2)),
             BUILD=(1,80,/,1:7X,8:%01,11:C'FILLER      PIC Z(01).')),
                                                           
            IFTHEN=(WHEN=(83,4,ZD,EQ,+1),BUILD=(1,80))


Output :-

       15 W541-DTRMNT-RATE-KEY OCCURS 10 TIMES
              INDEXED BY W541-DTRMNT-INDX .
       18 W541-DTRMNT-CD      PIC X(4)       .
       18 FILLER      PIC Z(01).
       18 W541-DTRMNT-REDEFN.
       21 W541-DTRMNT-VAL     PIC X(20)      .
       21 FILLER      PIC Z(01).
       21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(20).                 
       21 FILLER      PIC Z(01).   
       21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL
           PIC 9(10)V9(8).       
       21 FILLER      PIC Z(01). 
       21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(10).       
       21 FILLER      PIC Z(01). 
       21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL
           PIC X(8).         
       21 FILLER      PIC Z(01).
       12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .
       12 FILLER      PIC Z(01).
       12 W541-SLS-TAX-AMT        PIC Z(8)V9(4).
       12 FILLER      PIC Z(01).
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: How to store and retain values in JCL

Postby nikesh_rai » Wed Jan 23, 2013 4:24 pm

Thanks bodatrinadh,

The tricks worked.. :), I modified your when=group card and its working fine..

Here is the sysin card i used:

in first step:
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  OUTFIL IFTHEN=(WHEN=GROUP,BEGIN(8,2,FS,EQ,NUM,AND,10,1,CH,EQ,C' '),
                 END=(1,80,SS,EQ,C'PIC ',AND,1,80,SS,EQ,C'.'),       
                 RECORDS=3,PUSH=(73:8,2))                           
/*                 


in second step:
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  OUTFIL IFTHEN=(WHEN=(8,2,FS,EQ,NUM,AND,10,1,CH,EQ,C' ',AND,     
                       1,80,SS,EQ,C'PIC ',AND,1,80,SS,EQ,C'.'),   
                 PARSE=(%01=(ABSPOS=73,STARTAT=NONBLANK,           
                             ENDBEFR=BLANKS,FIXLEN=2)),           
                 BUILD=(1,80,/,1:C'       ',8:%01,                 
                        11:C'FILLER      PIC Z(01).')),           
         IFTHEN=(WHEN=(8,3,CH,EQ,C' ',AND,1,80,SS,EQ,C'PIC ',AND, 
                       1,80,SS,EQ,C'.'),                           
                 PARSE=(%02=(ABSPOS=73,STARTAT=NONBLANK,           
                             ENDBEFR=BLANKS,FIXLEN=2)),           
                 BUILD=(1,80,/,1:C'       ',8:%02,                 
                        11:C'FILLER      PIC Z(01).'))             


and the output comes what i was expecting:

 18 W541-DTRMNT-CD      PIC X(4)       .             
 18 FILLER      PIC Z(01).                           
 18 W541-DTRMNT-REDEFN.                             
 21 W541-DTRMNT-VAL     PIC X(20)      .             
 21 FILLER      PIC Z(01).                           
 21 W541-DTRMNT-ALPH-VAL REDEFINES W541-DTRMNT-VAL   
      PIC X(20).                                     
 21 FILLER      PIC Z(01).                           
 21 W541-DTRMNT-NUM-VAL REDEFINES W541-DTRMNT-VAL   
      PIC 9(10)V9(8).                               
 21 FILLER      PIC Z(01).                           
 21 W541-DTRMNT-DT-VAL REDEFINES W541-DTRMNT-VAL     
      PIC X(10).                                     
 21 FILLER      PIC Z(01).                           
 21 W541-DTRMNT-TM-VAL REDEFINES W541-DTRMNT-VAL     
      PIC X(8).                                     
 21 FILLER      PIC Z(01).                           
 12 W541-SLS-TAX-EXMPTN-NBR PIC X(10)    .           
 12 FILLER      PIC Z(01).                           


Thanks Billy and Bodatrinadh, thanks a lot to both of you.. :)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 192
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post