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
 

 

Need SORT Card to reformat the file

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

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Wed Apr 04, 2012 12:02 pm    Post subject: Need SORT Card to reformat the file
Reply with quote

Hi all,

The input file is as follows,

Code:
PGM Name | Active / Obsolete
PGM1           Active
PGM1           Active
PGM1           Obsolete
PGM1           Obsolete
PGM2           Active
PGM2           Active
PGM2           Active
PGM2           Obsolete

In the output file, we need the count of Active & Obsolete for each program,

Code:
Pgm Name | Active Count | Obsolete Count
PGM1                2               2
PGM2                3               1


We can assume that the input file is FB with record length of 80 and sorted on Program Name.

I have managed to get count of Active or Obsolete separately with 2-3 SORT steps, but just wanted to know if this is possible in lesser no. of steps or single step?

Many thanks.

Shankar
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Wed Apr 04, 2012 12:47 pm    Post subject: Reply to: Need SORT Card to reformat the file
Reply with quote

This might get you started.

Code:
//SECTCT EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(16,8,CH,EQ,C'ACTIVE  '),
           OVERLAY=(20:C'1',30:C'0')),
         IFTHEN=(WHEN=(16,8,CH,EQ,C'OBSOLETE'),
           OVERLAY=(20:C'0',30:C'1')),
         IFTHEN=(WHEN=NONE,
           OVERLAY=(20:C'0',30:C'0'))
  OUTFIL REMOVECC,NODETAIL,
  OMIT=(1,8,CH,EQ,C'PGM NAME'),
      HEADER1=('PGM NAME | ','ACTIVE COUNT | ','OBSOLETE COUNT'),
  SECTIONS=(1,8,
     TRAILER3=(1,8,TOTAL=(20,1,ZD,M10,LENGTH(15)),
                   TOTAL=(35,1,ZD,M10,LENGTH(15))))
//*
//SORTIN   DD *
PGM NAME | ACTIVE / OBSOLETE
PGM1           ACTIVE
PGM1           ACTIVE
PGM1           OBSOLETE
PGM1           OBSOLETE
PGM2           ACTIVE
PGM2           ACTIVE
PGM2           ACTIVE
PGM2           OBSOLETE


Output:
Code:


PGM NAME | ACTIVE COUNT | OBSOLETE COUNT
PGM1                  2              2   
PGM2                  3              1   
Back to top
View user's profile Send private message
shankarparab80

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Wed Apr 04, 2012 2:15 pm    Post subject:
Reply with quote

Thanks a lot Bill, it is working.

The only change required was position for Online Count, it should have been 30 instead of 35.

TOTAL=(30,1,ZD,M10,LENGTH(15))))

But rest, it is working absolutely correct. Thanks once again.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Wed Apr 04, 2012 2:23 pm    Post subject: Reply to: Need SORT Card to reformat the file
Reply with quote

Glad you have it working. Sorry about the 35/30. I started to try to get the line-up done, then thought "what the heck" and forgot to UNDO before copying. Then missed that when fixing-up after the "paste". No time saved at all in the end :-)
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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