MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Martin Beginner Joined: 20 Mar 2006 Posts: 133 Topics: 58
Posted: Sat Mar 03, 2007 9:25 am Post subject: Select fields from 2 diff and merge into 1 single record
Hi All,
Here's an input file :
Code:
abc00 12345600000000000 xyz
abc01 000000020050101 pqr
Output file :
Here's the criteria
I need to select 123456 from record which has key abc00 anda 20050101 from record which has key abc01...
We have syncsort on our system...
Please help...
Here's the version of SYNCSORT
SYNCSORT FOR Z/OS 1.2.1.1R U.S. PATENTS: 4210961, 5117495 (C)
z/OS 1.6.0
Back to top
Martin Beginner Joined: 20 Mar 2006 Posts: 133 Topics: 58
Posted: Sat Mar 03, 2007 9:27 am Post subject:
file is an FB anda LRECL - 289
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Mar 05, 2007 6:14 am Post subject:
Martin,
Try this
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC00 12345600000000000 XYZ
ABC01 000000020050101 PQR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
//SYSIN DD *
SORT FIELDS=(290,08,CH,A)
SUM FIELDS=(007,06,ZD,
014,08,ZD)
INREC IFTHEN=(WHEN=(01,05,CH,EQ,C'ABC00'),
OVERLAY=(290:SEQNUM,8,ZD,
014:8C'0')),
IFTHEN=(WHEN=(01,05,CH,EQ,C'ABC01'),
OVERLAY=(290:SEQNUM,8,ZD,
07:6C'0'))
OUTREC FIELDS=(07,06,X,14,8)
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Martin Beginner Joined: 20 Mar 2006 Posts: 133 Topics: 58
Posted: Tue Mar 06, 2007 2:37 am Post subject:
kolusu ,
I appologize for this.. . But the input file layout has changed now.
Code:
abc00 123456 xyz
abc01 20050101.abcd pqr
The zeroes in the records are now replaced by spaces..
Any solutions?
Thanks,
Mt
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Mar 06, 2007 6:27 am Post subject:
Martin ,
It does not matter if your input has zeroes or spaces. The job will work fine.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Martin Beginner Joined: 20 Mar 2006 Posts: 133 Topics: 58
Posted: Tue Mar 06, 2007 11:59 am Post subject:
kolusu ,
I got a S0C7 when I ran it....
One ques... correct me if am wrong here..
Can we sum up non numeric fields here ??
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Mar 06, 2007 12:22 pm Post subject:
Martin wrote: kolusu ,
I got a S0C7 when I ran it....
One ques... correct me if am wrong here..
Can we sum up non numeric fields here ??
martin,
You are just wasting my time as well as yours. If you posted the complete requirements then it would have been easy. Everytime you post you add a new requirement to the question.
Answer the following questions
1. Does input have only ABC00 and ABC01 records?
2. Does ABC01 record ALWAYS follow ABC00 record?
3. What is the position and format of the fields to be merged?
4. Show us a sample data with all the possible values and desired output
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Martin Beginner Joined: 20 Mar 2006 Posts: 133 Topics: 58
Posted: Wed Mar 07, 2007 12:04 pm Post subject:
kolusu ,
Below are the details:
1) No there can be other record as well... But I need to just selct the records with record key ABC00 anda ABC01
2) Yes.. ABC01 reord always follows ABC00 record.
3) 123456 in 8th position in record ABC00. ( Note the is followed by spaces.)
20050101.abcd in 16 th postion in record ABC01.
4)
Code:
Input:
abc00 123456 xyz
abc01 20050101.abcd pqr
abc02 1233434 ghuuo jjjiiiiiii
abc03 99993434399999999 44444
abc00 123457 xyz
abc01 20063101.pqrs pqr
abc02 1111111 uuiiiidadada jjiiiiiii
abc03 99993434399999999 44444
output:
123456 20050101.abcd
123457 20063101.pqrs
I really apologize for the confusion
-Mt
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Mar 07, 2007 12:23 pm Post subject:
Martin ,
try this job
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
----+----1----+----2----+----3----+----4----
//SORTIN DD *
ABC00 123456 XYZ
ABC01 20050101.ABCD PQR
ABC02 1233434 GHUUO JJJIIIIIII
ABC03 99993434399999999 44444
ABC00 123457 XYZ
ABC01 20063101.PQRS PQR
ABC02 1111111 UUIIIIDADADA JJIIIIIII
ABC03 99993434399999999 44444
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,5,SS,EQ,C'ABC00,ABC01')
SORT FIELDS=(290,08,CH,A)
SUM FIELDS=(008,04,BI,
012,02,BI,
016,08,BI,
024,04,BI,
028,02,BI)
INREC IFTHEN=(WHEN=(01,05,CH,EQ,C'ABC00'),
OVERLAY=(290:SEQNUM,8,ZD,
016:14X'00')),
IFTHEN=(WHEN=(01,05,CH,EQ,C'ABC01'),
OVERLAY=(290:SEQNUM,8,ZD,
008:6X'00'))
OUTREC FIELDS=(08,06,X,16,13)
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum