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
 

 

Can I do this with DFSORT?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can I do this with DFSORT?
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: 1187
Location: Bangalore,India

PostPosted: Thu Sep 14, 2006 9:51 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Sep 14, 2006 8:48 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Sep 15, 2006 5:02 am    Post subject:
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    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 DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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