Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sorting VB dataset based on CHANGE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sorting VB dataset based on CHANGE
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 Moderator


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

PostPosted: Thu Nov 04, 2010 11:37 pm    Post subject:
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    Post subject: Reply to: Sorting VB dataset based on CHANGE
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

Site Director


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

PostPosted: Fri Nov 05, 2010 7:10 pm    Post subject:
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 Moderator


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

PostPosted: Sat Nov 06, 2010 12:01 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us