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

Can I do this with DFSORT?


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

New User


Joined: 05 Jan 2006
Posts: 72

PostPosted: Thu Sep 14, 2006 5:55 am
Reply with quote

Hi,

I have an input file that has approx 6,000 records.

Starting at Col 27 is field VOLSER (length 6),
Starting at Col 119 is field AGE (length 4),

Code:
IE:
<snip>  V00001 <snip> 235
<snip>  V02001 <snip>  35
<snip>  V60001 <snip>   5
<snip>  V00701 <snip>1235
etc.


I would like to process these records and create an output file that looks like this:
Code:
    EJECT VOLSER(V00002, -
                 V01007, -
                 V02007, -
                 V03007, -
                 V04007, -
                 V05007, -
                 V06007, -
                 V07007, -
                 V08007, -
                 V09007)


The output file should be sorted in VOLSER order, but only contain the 10 records with the highest AGE.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Sep 14, 2006 9:51 am
Reply with quote

yes it is possible using sort. U just need to sort the record on Volser descending order & stopafter 10 record

Sort fields = (119,4,CH,D,27,6,CH,A)
STOPAFT=10

Correction r welcome
Back to top
View user's profile Send private message
TizMe

New User


Joined: 05 Jan 2006
Posts: 72

PostPosted: Thu Sep 14, 2006 10:47 am
Reply with quote

No, that wont produce the desired results. The output would be still sorted by descending AGE. The output should be in ascending VOLSER order. (but contain the 10 records with the highest AGE)

I guess that I'll have to actually sort it twice, but can it all be done in one sort step?

And how do I get OUTREC to perform slightly different for the first and last records?
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 Sep 14, 2006 8:48 pm
Reply with quote

Tizme,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
SORT FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC BUILD=(1:27,6,7:119,4)
  SORT FIELDS=(7,4,ZD,D)
  OUTFIL FNAMES=T1,ENDREC=10
/*
//CTL2CNTL DD *
  SORT FIELDS=(1,6,CH,A)
  OUTFIL FNAMES=OUT,
    IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(7:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(7,8,ZD,EQ,+1),
      BUILD=(C'   EJECT VOLSER(',1,6,C', -')),
    IFTHEN=(WHEN=(7,8,ZD,EQ,+10),
      BUILD=(17:1,6,C')')),
    IFTHEN=(WHEN=NONE,
      BUILD=(17:1,6,C', -'))
/*
Back to top
View user's profile Send private message
TizMe

New User


Joined: 05 Jan 2006
Posts: 72

PostPosted: Fri Sep 15, 2006 4:26 am
Reply with quote

Thats great, thanks for your input.

I am falling in love with DFSORT, "Don't tell the wife" icon_wink.gif
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: Fri Sep 15, 2006 5:02 am
Reply with quote

Quote:
I am falling in love with DFSORT, "Don't tell the wife"


Just tell her it's a pet. icon_lol.gif (Everyone knows which pet I prefer.)
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top