Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SORT requirement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Fri Jan 25, 2008 12:52 pm    Post subject: SORT requirement
Reply with quote

Below is the requirement we have, please let me know how can we handle it using sort.

I have the file with following fields (lrecl = 43)

Code:

FIELD1        FIELD2         FIELD3
8/AN          15/SNUM        20/AN
--------      --------       ------
123/2345       400.00        AAA111
111/896        300.00        BBA222
111/896        250.00        BBA222
111/896       -100.00        BBA222
888/970        800.00        CDD333
888/970       -100.00        CDD333
910/999        200.00        XYX444
910/999        200.00        XYX444


We need to sort the above file using the field1 and Field3 as key fields and sum the amount for the key fields except the records with field1 value
of '888/970' has to be written in the o/p file as it is from i/p file without summation. The o/p file also need to reformatted to have the first26 bytes alone from i/p file, rest being spaces for all the records except '888/970' records.

Hence, the o/p file should look like the one below.(LRECL=43)

Code:

FIELD1        FIELD2         FIELD3
8/AN          15/SNUM        20/AN
--------      --------       ------
111/896        450.00        BBA
123/2345       400.00        AAA
888/970        800.00        CDD333
888/970       -100.00        CDD333
910/999        400.00        XYX


Thanks in advance,
Chinni.
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 Jan 25, 2008 10:55 pm    Post subject:
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/43)
//SORTOUT DD DSN=...  output file (FB/43)
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(9:9,15,SFF,TO=ZD,LENGTH=15,44:8C'0')),
    IFTHEN=(WHEN=(1,8,CH,EQ,C'888/970'),OVERLAY=(44:SEQNUM,8,ZD))
  SORT FIELDS=(1,8,CH,A,24,20,CH,A,44,8,ZD,A)
  SUM FIELDS=(9,15,ZD)
  OUTREC IFOUTLEN=43,
    IFTHEN=(WHEN=INIT,
      OVERLAY=(9:9,15,ZD,EDIT=(SIIIIIIIIIIT.TT),SIGNS=(,-))),
    IFTHEN=(WHEN=(1,8,CH,NE,C'888/970'),BUILD=(1,26))
/*
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Mon Jan 28, 2008 2:16 pm    Post subject: Reply to: SORT requirement
Reply with quote

Thanks Frank. It really helps us.!!! Thanks again!!!
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us