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
 
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: 7315

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: 7315

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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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