Page 1 of 1

SYNCSORT when=group end condition with multiple end records

PostPosted: Mon Apr 21, 2014 11:47 pm
by chandu_rck
Hi
I have input file of rec lenght 1107.Each group starts with record type 1 and ends with rec type 9(first character) .

I want to extract the first group 1 into a separate file.
Inputfile:

1|clientname1
2|address1
2|address2
9|Account1
9|account2
1|clientname2
2|address1
9|Account 3
 

//SYSIN    DD *                                                    
   SORT FIELDS=COPY,                                                
   SKIPREC=570                                                      
   OUTREC IFTHEN=(WHEN=GROUP,END=(1,2,CH,EQ,C'9|'),PUSH(1108:ID=8))
   OUTFIL BUILD=(1,1107),INCLUDE=(1108,8,ZD,EQ,1)  
 

with the above sync sort. I am missing the second instance of 9| record.
Actual output
1|clientname1
2|address1
2|address2
9|Account1
 

Expected output
1|clientname1
2|address1
2|address2
9|Account1
9|account2<-This record is missing.
 

Appreciate your help!

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Tue Apr 22, 2014 12:04 am
by chandu_rck
HI adding to the above question.I cannot use the below Syncsort as I don't have fixed BEGIN record type. BEGIN record can be anynumber between 1 to 8.The only condition I have is I can have multiple end records of type 9.

//SYSIN DD *
SORT FIELDS=COPY,
SKIPREC=558
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'1|'),PUSH(1108:ID=8))
OUTFIL BUILD=(1,1107),INCLUDE=(1108,8,ZD,EQ,1)
//*

Thanks

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Tue Apr 22, 2014 1:59 am
by BillyBoyo
What is the SKIPREC for?

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Tue Apr 22, 2014 2:58 am
by chandu_rck
Sorry please ignore the skiprec.That can be removed

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Tue Apr 22, 2014 5:21 am
by BillyBoyo
This:

  OPTION COPY
                                                               
  INREC IFTHEN=(WHEN=GROUP,END=(1,2,CH,EQ,C'9|'),PUSH(40:ID=8)),
        IFTHEN=(WHEN=GROUP,
                  BEGIN=(1,2,CH,EQ,C'9|',
                       AND,40,8,CH,EQ,C'00000001'),
                  END=(1,2,CH,LT,C'9|'),
                  PUSH=(50:40,8))


With this:

                                                               
//SORTIN   DD *
1|CLIENTNAME1
2|ADDRESS1
2|ADDRESS2
9|ACCOUNT1
9|ACCOUNT2
9|ACCOUNT3
1|CLIENTNAME2
2|ADDRESS1
9|ACCOUNT 4
9|ACCOUNT 5
1|CLIENTNAME2
2|ADDRESS1
9|ACCOUNT 6


Gives this:

1|CLIENTNAME1                          00000001           
2|ADDRESS1                             00000001           
2|ADDRESS2                             00000001           
9|ACCOUNT1                             00000001  00000001
9|ACCOUNT2                             00000002  00000001
9|ACCOUNT3                             00000003  00000001
1|CLIENTNAME2                          00000004  00000001
2|ADDRESS1                             00000004           
9|ACCOUNT 4                            00000004           
9|ACCOUNT 5                            00000005           
1|CLIENTNAME2                          00000006           
2|ADDRESS1                             00000006           
9|ACCOUNT 6                            00000006 


You should be able to amend your INCLUDE= so that it gets 1,2, of '9|' and the second extended field being C'00000001' in addition to your existing condition.

There's quite a lot of repetition. Have you considered using SORT symbols? They have many advantages, one of which is only having to type positions and values once (after that you use a name).

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Wed Nov 23, 2016 1:35 pm
by Surabhi
Hi Billy Boyo,
I have a similar requirement.
And as you said this seems to be quite repetative.
So i am thinking of using SORT symbols the way you suggested.I tried finding some info on this but no luck.
Could you give me any link which i can refer to for this.

Thank you.

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Wed Nov 23, 2016 4:56 pm
by NicC
Do not address your post to a specific person.

What have you read in the manual that you do not understand?

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Wed Nov 23, 2016 5:15 pm
by Surabhi
Hi,
Apologies for addressing it to a specific person.
I dint get any Link or manunal to refer for Specific Sort Symbols to be used in When=Group.
So, can anyone provide me the link which i can go through for this.
Any help appreciated.

Thank you.

Re: SYNCSORT when=group end condition with multiple end rec

PostPosted: Wed Nov 23, 2016 11:39 pm
by NicC
How about trying the Syncsort manual as it is a Syncsort feature?