View previous topic :: View next topic
|
Author |
Message |
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi,
I need small assistance regarding Sort :
My requirements are as below:
Input File:
Code: |
NAA0010000
NAA0020000
NAA003NEWA
NAA0010001
NAA0020000
NAA003
NAA0010000
NAA0020000
NAA003
|
Input file is a FB file with LRECL of 160 and its starting records are of three types(Length of all would be 160 ).
Type 1 :Starts with NAA001
Type 2 :Starts with NAA002
Type 3 Starts with :NAA003
Desired Output:
Code: |
"Record 1 -160bytes record"|"Record Type 2" - 160 byte|"Record Type 3"
"Record 1 -160bytes record"|"Record Type 2" - 160 byte|"Record Type 3"
|
I Output we should have the 3 type of records together differentiated by a pipe.
There are also some conditions as below:
1.)IF all three records Rec1, rec2, rec3 are present consecutively they should be together in the output.
2.) If rec1 is present and rec 2 (or rec3) not present, we should have 160 spaces for that record at their respective place.
3.) If rec1 is not present there should be 160 spaces at the rec1 place and whatever record is present next it should be available at the particular row.
I hope this is possible using Sort.
Let me know If any other input is needed. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
I hope this is possible using Sort. |
Are you having DFSORT in your shop? What does your SYSOUT messages say? |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi Arun,
We do have DFSORT . - NOT
and What are we looking for in the SYSYOUT messages.
I wanted a sortcard for this issue. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
What are we looking for in the SYSYOUT messages |
Your sort product name and version. |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Is this what we are looking for :
SYNCSORT FOR Z/OS 1.3.2.1R |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
Is this what we are looking for :
SYNCSORT FOR Z/OS 1.3.2.1R |
You said you "do have DFSORT", and now you say your SYSOUT says Syncsort!!!!!.
DFSORT and Syncsort are DIFFERENT sort products. They are not the same. I wonder why people always tend to say they have the wrong product. |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi Arun,
Regret for the wrong info provided :
I have tried this code which is successfully working for joining two records :
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=XXXX.AAA,DISP=SHR
//OUT DD DSN=XXXX.BBB,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=320,BLKSIZE=0),
// UNIT=PRODA,
// SPACE=(CYL,(320,100),RLSE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(161:1,160,161:SEQ=1))
OUTFIL FNAMES=OUT,INCLUDE=(161,1,ZD,EQ,2),
BUILD=(161,160,1,160)
|
Could you please let me know how is it to be modified for three records and with that conditions.
Thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
How do you handle the below scenario.
You have Rec1 and no Rec2,Rec3 for the First Group. And you don't have Rec1, but have Rec2, Rec3 for the second group. Evenif the input is like this
expected output should be
Code: |
Rec1 spaces spaces
spaces Rec2 Rec3 |
How will you identify this though the input looks like a candidate for a combined record for all 3 types like this.
Sorry if I messed up the whole thing |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi Arun ,
Since the above scenerio stated by you can't be checked by data available , so it would best go as Stated by you:
Quote: |
Code:
Rec1 Rec2 Rec3
|
And no mess and a very Valid question |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi,
I have also managed to get all the three records (but without condition):
Code: |
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=XXXX.AAA,DISP=SHR
//OUT DD DSN=XXXX.BBB,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=480,BLKSIZE=0),
// UNIT=PRODA,
// SPACE=(CYL,(100,50),RLSE)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(481,8,CH) KEEPNODUPS WITHEACH -
WITH(161,160) WITH(321,160) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(481:ID=8,SEQ=1)),
IFTHEN=(WHEN=(489,1,ZD,EQ,2),BUILD=(161:1,160,481:481,8)),
IFTHEN=(WHEN=(489,1,ZD,EQ,3),BUILD=(321:1,160,481:481,8))
OUTFIL FNAMES=OUT,BUILD=(1,480)
/*
|
Could someone assist with the conditions part ??
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Arun,
Quote: |
DFSORT and Syncsort are DIFFERENT sort products. They are not the same. I wonder why people always tend to say they have the wrong product. |
Because DFSORT has a separate / standalone part of the forum. . . |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Thanks Dick for moving it to the right Forum.
Could you please assist me with the solution for the issue.
Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
If this was a requirement for my group, it would be done with code not sort. . . I suspect there is more to the requirement than only re-arranging the data.
I slso suspect that there is a desire to create these consolodated records so that the original file will not need to be used by some programmer(s) (either due to lack of skill or just wanting to avoid the work).
Most of what i'm involved with is hundreds of millions of records of length from 4k to 30k bytes and extra passes and copies are not encouraged. . .
d |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Hi Dick,
But I would really need a solution to this Either your way or the Sort way.
May be Frank from could lend some suggestion.
And about the requirements they are currently only for rearranging the data.
Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You have Syncsort.
Frank is a DFSORT developer and usually does not answer Syncsort questions as they are competing products.
Write code to read the records, store them until the "next key" is encountered, and then write what is needed to the output file. |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
Thanks a lot Dick for your suggestion .
But I still hope , somebody from Synchsort could really advise on this.
and I need this urgently now. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Saurabh Pune wrote: |
But I still hope , somebody from Synchsort could really advise on this.
and I need this urgently now. |
Oh well, that's life.
This is actually a HELP FORUM, and although you appear to have tried something yourself, while sitting around waiting for the person you deem as the "right" person to advise, I would have taken up the suggestion of Dick and worked on an alternative solution.
As for any urgency, tough luck, that is solely YOUR problem and expecting to get a timeous solution from a volunteer forum is not the way to proceed. |
|
Back to top |
|
|
Saurabh Pune
New User
Joined: 26 May 2009 Posts: 23 Location: USA
|
|
|
|
thanks Expat for the inspiring words.
Quote: |
As for any urgency, tough luck, that is solely YOUR problem and expecting to get a timeous solution from a volunteer forum is not the way to proceed.
|
I am still working different things with the Sort itself bcoz I have worked on it frm last 5 days, and just don't want and feel to start afresh with the COBOL thing, although the Advice still stands good.
Just looking for some Timely help from a HELP FORUM
Hope is what keeps everybody alive |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Thanks a lot Dick for your suggestion |
You're welcome
Quote: |
Hope is what keeps everybody alive |
Hope along with the willingness to change direction when the situation calls for it.
In the future, suggest you place a (short) restriction on how long you will wait for someone to provide the "sort code". If, when you read my reply (i replied on the 12th), you had implemented the code, it would have been done on Saturday. . . It should be a very small amount of code.
Also, it is usually not a good idea to post urgent problems on a help forum. Others do not have/share your sense of urgency. Something else to consider is to open a support issue directly with Syncsort. |
|
Back to top |
|
|
|