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

Sorting VB dataset based on CHANGE


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Thu Nov 04, 2010 9:18 am
Reply with quote

Hi All,

I am having following requirement

Input Dataset Type VB
At 7 column At 55th Column
JAB 12345
JBC 23456
BCA 34567

Change before sort that needs to be done is
JAB 01
JBC 02
BCA 03

Now I need to sort them based on changed field and data at column 55 and report it into dataset of LRECL 80 ,RECFM is FB.

The o/p of the above sample data will be:
01 12345
02 23456
03 34567

Can we achive this using sort.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 04, 2010 11:37 pm
Reply with quote

Your description is not very clear. For example, the data at position 7 doesn't seem to matter. But assuming that position 55 includes the RDW, and you want to sort by the added 2 digit sequence number and the 5 byte field starting at position 5, here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  INREC BUILD=(1,4,SEQNUM,2,ZD,X,55,5)
  SORT FIELDS=(5,2,CH,A,8,5,CH,A)
  OUTFIL VTOF,BUILD=(5,8,80:X)
/*


If that's not what you want, then please describe more clearly what you do want.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Nov 05, 2010 11:04 am
Reply with quote

Here is a better example

JAB 12345
JBC 23456
BCA 34567
JAB 56789
JBC 67890
BCA 78901

Output data
01 12345
01 56789
02 23456
02 67890
03 34567
03 78901

I was able to do using 2 sort step.1st step to change the JAB to 01.JBC to 02 and BCA to 03.In 2nd step sorted in ascending order as 1st 2 column as primary column.Can we do it using one sort step?Is it a good practice to use INREC and OUTREC together?

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 05, 2010 7:10 pm
Reply with quote

Hello,

Is there some reason you did not post both input files for the "better" example?

Is there some reason you did not post your solution?

The more completely you post, the more likely you are to receive usable replies quickly. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 06, 2010 12:01 am
Reply with quote

In one step (pass), you can do the change with INREC, then the SORT and the OUTFIL to convert to FB. You can use INREC with IFTHEN clauses or INREC with CHANGE to do the change.

However, it's still not clear what you're trying to do. Are you only interested in the values 'JAB', 'JBC' and 'BCA' or can there be more/different values? If so, how would they be handled?

Are you trying to sort in the order:

JAB,number
JBC,number
BCA,number

or in some other way?

Since you don't have JAB, etc in the output, why do you need to change to JAB.01 instead of just to 01?
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top