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 -> Comma delimited and Zero supressed file

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

New User


Joined: 23 Oct 2007
Posts: 5
Location: Hyderabad

PostPosted: Thu Jun 19, 2008 9:59 am    Post subject: SORT -> Comma delimited and Zero supressed file
Reply with quote

Hi all,

I have a Req like this. Can this be done with SORT.

Input data

Code:

Field - A     Field - B
  1,000         250   ->> Both are 7 bytes. COBOl dec is (PIC ZZZ,ZZ9)
  2,000         500


Requirement (o/p data ):-
Add two more fields(Total and Percentage) at the end of the file.

Code:

Field - A     Field - B
  1,000         250
  2,000         500
===========
  3,000         750   --> Total is needed here
                25%   --> Percentage is needed in this line
                          ((Field - B/Field - A)*100)


Note:-
1. Field - A and Field - B is Zero supressed and COMMA delimited File.

We are doing this requirement in COBOL pgm.But i am curious to know whether we can do this in SORT icon_biggrin.gif icon_biggrin.gif ( which is always my favorite).

Thanks & Regards,
Anish K
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 19, 2008 10:38 pm    Post subject: Reply to: SORT -> Comma delimited and Zero supressed file
Reply with quote

anishkannath,

The following DFSORT/ICETOOL JCl will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD *                                               
----+----1----+----2----+----3----+----4----+----5----+----6---
  1,000,    250                                               
  2,000,    500                                               
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)     
//T2       DD DSN=&&T2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)     
//P        DD SYSOUT=*                                         
//TOOLIN   DD *                                               
  COPY FROM(IN) USING(CTL1)                                   
  COPY FROM(T1) USING(CTL2)                                   
//CTL1CNTL DD *                                               
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,                         
  BUILD=(80X),                                                 
  TRAILER1=(TOT=(1,7,UFF,EDIT=(TTTTTTTT)),X,                   
            TOT=(9,7,UFF,EDIT=(TTTTTTTT)))                     
/*                                                             
//CTL2CNTL DD *                                               
  INREC OVERLAY=(30:(+100,MUL,10,8,ZD),DIV,1,8,ZD,M10,LENGTH=3)
  OUTFIL FNAMES=T2,                                           
  BUILD=(C'T1,C''',1,8,C'''',/,                               
         C'T2,C''',10,8,C''''/,                               
         C'P1,C''',30,3,C'%''',80:X)                           
/* 
//STEP0200 EXEC PGM=ICEMAN               
//SYSOUT   DD SYSOUT=*                   
//SYMNOUT  DD SYSOUT=*                   
//SORTIN   DD *                         
----+----1----+----2----+----3----+----4-
  1,000,    250                         
  2,000,    500                         
//SYMNAMES DD DSN=&&T2,DISP=SHR         
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
  SORT FIELDS=COPY                       
  OUTFIL REMOVECC,                       
  TRAILER1=(01:C'=======',X,'=======',/,
            01:T1,10:T2,/,10:P1)         
/*
Back to top
View user's profile Send private message
anishkannath

New User


Joined: 23 Oct 2007
Posts: 5
Location: Hyderabad

PostPosted: Fri Jun 20, 2008 9:15 am    Post subject:
Reply with quote

Hi..

Thanks a lot for the reply. Code is working perfect.

One more question.

If i need to ZERO suppress and add COMMA delimiters for the the Final Total what should be the Edit in the trailer?

Thanks & Regards,
Anish Kannath
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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