IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT -> Comma delimited and Zero supressed file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top