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
 

 

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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm


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