IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Syncsort: Conditional joining of Records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 2:50 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 12, 2010 3:18 pm
Reply with quote

Quote:
I hope this is possible using Sort.
Are you having DFSORT in your shop? What does your SYSOUT messages say?
Back to top
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 3:28 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 12, 2010 3:37 pm
Reply with quote

Quote:
What are we looking for in the SYSYOUT messages
Your sort product name and version.
Back to top
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 3:53 pm
Reply with quote

Is this what we are looking for :

SYNCSORT FOR Z/OS 1.3.2.1R
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 12, 2010 4:08 pm
Reply with quote

Quote:
We do have DFSORT
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
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 4:48 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 12, 2010 4:59 pm
Reply with quote

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
Code:
Rec1
Rec2
Rec3
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.
Code:
Rec1 Rec2 Rec3
Sorry if I messed up the whole thing icon_lol.gif
Back to top
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 5:08 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 7:52 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 12, 2010 9:22 pm
Reply with quote

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
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Fri Nov 12, 2010 9:26 pm
Reply with quote

Thanks Dick for moving it to the right Forum.
Could you please assist me with the solution for the issue.

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 12, 2010 9:48 pm
Reply with quote

You're welcome icon_smile.gif

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
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Sat Nov 13, 2010 12:49 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Nov 13, 2010 1:16 am
Reply with quote

Hello,

You have Syncsort.

Frank is a DFSORT developer and usually does not answer Syncsort questions as they are competing products.

Quote:
Either your way
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
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Mon Nov 15, 2010 7:54 pm
Reply with quote

Thanks a lot Dick for your suggestion icon_smile.gif.
But I still hope , somebody from Synchsort could really advise on this.
and I need this urgently now.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 15, 2010 8:04 pm
Reply with quote

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
View user's profile Send private message
Saurabh Pune

New User


Joined: 26 May 2009
Posts: 23
Location: USA

PostPosted: Mon Nov 15, 2010 8:17 pm
Reply with quote

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 icon_smile.gif

Hope is what keeps everybody alive icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Nov 15, 2010 8:36 pm
Reply with quote

Hello,

Quote:
Thanks a lot Dick for your suggestion
You're welcome icon_smile.gif

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top