Page 1 of 1

Syncsort - why does not work

PostPosted: Sat Nov 24, 2012 9:48 pm
by ranga_subham
Hi,

May I please know why below sort card ends with U0016 ?

//STEP1000 EXEC PGM=SORT                                         
//SORTIN   DD *                                                 
ABCDEFGHIJ01236ZYXWVUTSRQ01234                                   
//SORTOUT  DD SYSOUT=*                                           
//SYSOUT   DD SYSOUT=*                                           
//SYSIN DD *                                                     
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=(11,5,ZD,SUB,26,5,ZD),OVERLAY=(40:C'PROB'))


Please help.

Re: Syncsort - why does not work

PostPosted: Sat Nov 24, 2012 10:29 pm
by BillyBoyo
Please post the full sysout from the step.

What are you trying to do with that WHEN condition?

Re: Syncsort - why does not work

PostPosted: Sun Nov 25, 2012 8:09 am
by ranga_subham
Bill, realized the mistake......corrected it as shown below and got the results (1st IFTHEN only) :idea:

//SYSIN DD *                                               
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(40:11,5,ZD,SUB,26,5,ZD)),
        IFTHEN=(WHEN=(40,1,ZD,GT,+1),BUILD=(1:C'PROBLEM')) 


But, why 2nd IFTHEN does not work though job ends with MAXCC=0 :?: Is it must to use OUTREC :?: Should not it have supplied previously built data to next IFTHEN :?:

Output:
ABCDEFGHIJ01236ZYXWVUTSRQ01234                       2   


Please help.

Re: Syncsort - why does not work

PostPosted: Tue Nov 27, 2012 9:38 am
by bodatrinadh
Hi Ranga,

But, why 2nd IFTHEN does not work though job ends with MAXCC=0 Is it must to use OUTREC Should not it have supplied previously built data to next IFTHEN


This is because, the value "2" is appearing in 54th position...

***************************** Top of Data ***********
----+----1----+----2----+----3----+----4----+----5----+----6----
ABCDEFGHIJ01236ZYXWVUTSRQ01234                       2                 
**************************** Bottom of Data ********


Change the code to -
IFTHEN=(WHEN=(54,1,ZD,GT,+1),BUILD=(1:C'PROBLEM')) 

Re: Syncsort - why does not work

PostPosted: Tue Nov 27, 2012 3:52 pm
by BillyBoyo
Missed that it was a WHEN=INIT, so my previous rubbish I removed :-)

When you do the calculation, you have not specified a length for the result, so it is using a default length. If you use TO=ZD and LENGTH=whatever, then you'll end up with a field where you think it should be.

Do not fall into the trap of just specifying a length of one. If the difference is 10 or greater, then you won't on occasion get the answer you want (try with difference of 10, 20, 30, 3000). Your result field should be "long enough" to hold the longest field which is being used in the calculation.

Re: Syncsort - why does not work

PostPosted: Thu Nov 29, 2012 9:54 am
by ranga_subham
Thank you Billy and 3nadh !