Symbolics in SORT card



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

Symbolics in SORT card

Postby Aki88 » Fri Mar 21, 2014 5:04 pm

Hello,

We have a requirement to generalize the sort cards by using symbolic parameters; this is to avoid writing different SORT cards for similar requirements. Same is required for instances where a particular field in the sort key can change depending on the user's requirement; for example: key contains sequence numbers, and the user wants to sort only on seq: 1 or seq: 2; here the values 1/2 will be input by the user and be passed to SORT cards through JP variables. I'd coded a test SORT card for this, the below piece being only a workaround solution to the actual problem:

// SET EDSEG=XXXX.XXX.XXX.XXXX,                               
//     FINALEXT=XXXX.XXX.XXX.XXXXXX.XXXX,                     
//     SEQ='1'                             * PASS SEQUENCE HERE
//*                                                           
//STEP001  EXEC PGM=SORT,COND=(0,NE),PARM=('JP1"&SEQ"')       
//SYSOUT   DD SYSOUT=*                                         
//SYMNOUT  DD SYSOUT=*                                         
//SORTIN   DD DSN=&EDSEG.1,DISP=SHR                           
//SORTOUT  DD DSN=&FINALEXT,                                   
//            DISP=(NEW,CATLG,DELETE),UNIT=(SYSDA),             
//            SPACE=(TRK,(10,20),RLSE),DCB=(RECFM=FB,LRECL=60)
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                             
 OMIT COND=((1,3,CH,EQ,C'000'),OR,                             
            (1,3,CH,EQ,C'999'))                               
 OUTFIL INCLUDE=((26,1,CH,EQ,JP1),AND,                 <--  problematic line
               (27,2,ZD,EQ,99),AND,                           
               (34,1,CH,EQ,C' ')),                             
 BUILD=(1:1,22,23:67,4,PD,EDIT=(TTTTTTT),LENGTH=7,             
                30:85,19,12X)
/*                         


The challenge that I'm facing here is SYMNAMES post translation converts i/p to C'<passed value>'; my i/p being a numeric value; ideally the correct SORT card should be as below post translation:

 OUTFIL INCLUDE=((26,1,ZD,EQ,1),AND,


I've tried passing the entire SORT card itself through the JP parameters, but even then post translation value is still not what I am looking for. Had to replace ZD with a CH to deliver the solution as a temp fix.
Is there a way to achieve the above result (basically getting a numeric value passed through symbolics in SORT) using a symbolic SORT card? :?

The current translated SORT card appears as below:

SORT FIELDS=COPY                                                       
OMIT COND=((1,3,CH,EQ,C'000'),OR,(1,3,CH,EQ,C'999'))                   
OUTFIL INCLUDE=((26,1,CH,EQ,C'1'),AND,(27,2,ZD,EQ,99),AND,(34,1,CH,EQ,*
              C' ')),BUILD=(1:1,22,23:67,4,PD,EDIT=(TTTTTTT),LENGTH=7,*
              30:85,19,12X)                                           


Thanks.
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: Symbolics in SORT card

 

Re: Symbolics in SORT card

Postby BillyBoyo » Fri Mar 21, 2014 5:30 pm

JPn"string" is what it is, and what is documented is what will be generated, JPn,S’string’.

So, no, there is no way for it to be used in a direct compare to a numeric field-type.

However, you could look at have a small step which takes the JPn and generates the actual control cards, and you'll have no problem with generating cards with just a numeric value from your original string.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Symbolics in SORT card

Postby Aki88 » Fri Mar 21, 2014 6:15 pm

Hey Billy,

Agree with you on that one; which is why, was looking for something that can get this done through an apt workaround, unlike the li'l messy one I've coded currently!

Coming to second point, have tried that as well though.

Prob here is JPn translates to C'<String>'; what I am trying to say is the character --> C' ' is added unconditionally if JPn is used.
Which will result in a job failure due to syntax error.

One of the sample test runs, where had tried replacing the entire SORT card:

// SET EDSEG=XXXX.XXX.XXX.XXXX,         
//     FINALEXT=XXXX.XXX.XXX.XXXXXX.XXXX,
//     SEQ='26,1,ZD,EQ,1'               
//*
//STEP002  EXEC PGM=SORT,COND=(0,NE),PARM=('JP1"&SEQ"')
//SYSOUT   DD SYSOUT=*                                 
//SYMNOUT  DD SYSOUT=*                                 
//SORTIN   DD DSN=&EDSEG.1,DISP=SHR                   
//SORTOUT  DD DSN=&FINALEXT,                           
//            DISP=(NEW,CATLG,DELETE),                 
//            UNIT=(SYSDA),                           
//            SPACE=(TRK,(10,20),RLSE),               
//            DCB=(RECFM=FB,LRECL=60)                 
//SYSIN    DD *                                       
 SORT FIELDS=COPY                                     
 OMIT COND=((1,3,CH,EQ,C'000'),OR,                     
            (1,3,CH,EQ,C'999'))                       
 OUTFIL INCLUDE=((JP1),AND,                           
               (27,2,ZD,EQ,99),AND,                   
               (34,1,CH,EQ,C' ')),                     
 BUILD=(1:1,22,23:67,4,PD,EDIT=(TTTTTTT),LENGTH=7,     
                30:85,19,12X)                         
/*


SYMNOUT:

------ SYMNAMES STATEMENTS FROM EXEC PARM -------
JP1,S'26,1,ZD,EQ,1'                             
                                                 
------------------ SYMBOL TABLE -----------------
JP1,C'26,1,ZD,EQ,1'


SYSOUT:

           SORT FIELDS=COPY                                       
           OMIT COND=((1,3,CH,EQ,C'000'),OR,                       
                      (1,3,CH,EQ,C'999'))                         
           OUTFIL INCLUDE=((JP1),AND,                             
                         (27,2,ZD,EQ,99),AND,                     
                         (34,1,CH,EQ,C' ')),                       
           BUILD=(1:1,22,23:67,4,PD,EDIT=(TTTTTTT),LENGTH=7,       
                          30:85,19,12X)                           
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED                 
           OUTFIL INCLUDE=((JP1),AND,                             
                            $                                     
ICE805I 1 JOBNAME: FASGUN1  , STEPNAME: STEP002                   
ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL                       
ICE283A 0 SYMBOL, SYNTAX OR DELIMITER ERROR                       
                         (27,2,ZD,EQ,99),AND,                     
                         (34,1,CH,EQ,C' ')),                       
           BUILD=(1:1,22,23:67,4,PD,EDIT=(TTTTTTT),LENGTH=7,       
                          30:85,19,12X)                           
ICE287A 0 ONE OR MORE ERRORS ENCOUNTERED DURING SYMBOL SUBSTITUTION


Just wondering, can this be done through two passes??? Maybe just generate the entire card using BUILD; and in next pass select the SORT card piece which is needed for final SORT card??? Though this would mean modifying the control cards in entirety ;)

Best Regards.
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: Symbolics in SORT card

Postby BillyBoyo » Fri Mar 21, 2014 7:57 pm

I think you have two choices: generate the cards, as I already mentioned; generate some new symbols from the JPn symbols.

//GENSYM EXEC PGM=SORT,PARM='JP9"1",JP8"745"'
//SYMNOUT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD dataset for SYMNAMES DD in next step
//SYSIN    DD *
  OPTION COPY,STOPAFT=1
  OUTFIL BUILD=(C'* I want these to be numeric JP9=',JP9,C'< JP8=',JP8,C'<',80:X,
                /,
                C'BBJP8,',JP8,
                /,
                C'BBJP9,',JP9)


This gives you:

* I want these to be numeric JP9=1< JP8=745<
BBJP8,745                 
BBJP9,1                   


Then in the control cards for the actual step, use BBJP8 and BBJP9:

  OPTION COPY                   
  INCLUDE COND=(1,10,ZD,EQ,BBJP8,
              OR,               
                1,10,ZD,EQ,BBJP9)


Which becomes...

 OPTION COPY                                 
 INCLUDE COND=(1,10,ZD,EQ,745,OR,1,10,ZD,EQ,1)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Symbolics in SORT card

Postby Aki88 » Fri Mar 21, 2014 8:15 pm

This is cool; I was thinking of something on the lines of two passes but that was way different from this!
Thanks a ton Billy; this serves the purpose; I can tweak around this to get the desired stuff.

Have a great weekend ahead.

Cheers! :D
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: Symbolics in SORT card

Postby Aki88 » Mon Mar 24, 2014 2:08 pm

Just adding; this being a wishlist item though :lol: maybe Kolusu or the DFSORT development team can add this for us in the coming releases: a symbolic that allows a user to pass Numeric data as well! Sorry if I am sounding tad bit lazy in doing the two passes, it is just that, I'd to change quite a lot of SORT cards :mrgreen:

<Just in case, this wish actually does come true, an advance Thank You to the DFSORT development team>

Cheers! :D
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post