Compare and Build rec in output



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Compare and Build rec in output

Postby rockstar2020 » Wed Aug 13, 2014 6:43 pm

Hello All,
I am looking for some help on below requirement.
START                                           AAAAAA 030054 000001 0801           
 MIKE                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    XXXX
                        22222222222222222222222222222222222222222    XXXX
 MARK                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    YYYY
                        22222222222222222222222222222222222222222    YYYY
                        DATE201408
START                                           BBBBBB 030054 000001 0801             
 JOHN                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    ZZZZ
                        22222222222222222222222222222222222222222    ZZZZ
                        DATE201407
 TREJ                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    WWW
                        22222222222222222222222222222222222222222    WWW


Above is the sample data and you can see from one START to other START there will be one DATE field available. I need date field value(ex-201408) within every START to be merged on to the corresponding first START(first row) of every record group preferably at the end as shown below.

START                                           AAAAAA 030054 000001 0801            201408
 MIKE                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    XXXX
                        22222222222222222222222222222222222222222    XXXX
 MARK                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    YYYY
                        22222222222222222222222222222222222222222    YYYY
                        DATE201408
START                                           BBBBBB 030054 000001 0801             201407
 JOHN                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    ZZZZ
                        22222222222222222222222222222222222222222    ZZZZ
                        DATE201407
 TREJ                   EMPLOYEE DETAILS
                        11111111111111111111111111111111111111111    WWW
                        22222222222222222222222222222222222222222    WWW


Every group will start with 'START' at first position
I tried using OUTREC IFTHEN GROUP, but am not able to cut the DATE field which is at the bottom or middle of every group and merge back to the START of the rec.
basically OUTREC IFTHEN GROUP START and END considers the first of the record only.

it is okAY even an output below as well. I dont mind if any extra data has to populated at the end to achieve this but just need the corresponding date value in every START record(first rec) whatever position maybe.

START                                           AAAAAA 030054 000001 0801            201408
 MIKE                   EMPLOYEE DETAILS                                             201408
                        11111111111111111111111111111111111111111    XXXX            201408
                        22222222222222222222222222222222222222222    XXXX            201408
 MARK                   EMPLOYEE DETAILS                                             201408
                        11111111111111111111111111111111111111111    YYYY            201408
                        22222222222222222222222222222222222222222    YYYY            201408
                        DATE201408                                                   201408   
START                                           BBBBBB 030054 000001 0801            201407
 JOHN                   EMPLOYEE DETAILS                                             201407
                        11111111111111111111111111111111111111111    ZZZZ            201407
                        22222222222222222222222222222222222222222    ZZZZ            201407
                        DATE201407                                                   201407
 TREJ                   EMPLOYEE DETAILS                                             201407
                        11111111111111111111111111111111111111111    WWW             201407
                        22222222222222222222222222222222222222222    WWW             201407


Any help is appreciated and let me know for any more info.

Thanks
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare and Build rec in output

Postby BillyBoyo » Wed Aug 13, 2014 8:53 pm

So every group of START has the DATE record somewhere? A 1:1 relationship?

If so, you need a JOINKEYS with the same DSN for both JOINKEYS files.

In JNF1CNTL you do a WHEN=GROUP for the START and PUSH an ID (make it long enough for number of groups on your file).

In JNF2CNTL, INCLUDE COND= for the DATE. WHEN=GROUP for DATE and PUSH an ID (same size as the other) and the date you want. You can PUSH to position 1: and cut down to just what you need using IFOUTLEN.

Use the ID on both files as the key for the JOINKEYS, specify SORTED,NOSEQCK.

In the REFORMAT statement, put your entire F1 excluding the ID, and the date itself from the F2.

If you don't really want the dates on all records, you can set it to blank with INREC IFTHEN=(WHEN=(test for START not being true.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Compare and Build rec in output

Postby rockstar2020 » Thu Aug 14, 2014 1:35 am

Thanks BIll for the reply. I'm using JNF cntl cards first time and am trying my best to understand and work out.
I've followed ur suggestion and my code looks like below. COnsider 80 as existing length and DATE field starts at 30. I was not able to understand your 'JNF2CNTL' part explanation with INCLUDE COND though.

//SYSIN DD *                                                     
  JOINKEYS FILE=F1,FIELDS=(81,10,A),SORTED,NOSEQCK               
  JOINKEYS FILE=F2,FIELDS=(81,10,A),SORTED,NOSEQCK               
  REFORMAT FIELDS=(F1:1,80,F2:94,6)                           
  SORT FIELDS=COPY                                               
    OUTFIL FILES=01                                               
/*                                                               
//JNF1CNTL DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'START'),       
                           PUSH=(81:ID=10))                     
//*                                                               
//JNF2CNTL DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(30,4,CH,EQ,C'DATE'),           
                           PUSH=(81:ID=10,91:SEQ=3,34,6))       
//*                                                               


But on the output file i am getting about 200 duplicates for each row from input file(eventhough no duplicates in the file) and resulting in SB37 and this should not happen as well. I want the original records count in output with date field appended.

Please correct the code if its wrong and help me understand and solve the problem.

Thanks
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare and Build rec in output

Postby rockstar2020 » Fri Aug 15, 2014 5:40 pm

Any help on the above will be highly appreciated . Thank you.
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post