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

ICETOOL/ICEMAN to sort two fields on a file to find MAX /MIN


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Mon Aug 13, 2012 2:36 pm
Reply with quote

Hi ,

Iam using a flat file which has 3 columns (A,B,C) out of which A & C are numeric fields

Code:
A       B            C
0005  XXXX    1000
0047  XXXX    3000
0016  XXXX    0500
0081  XXXX    1200
0009  XXXX    1400

i need to format the output file to have columns D & E & G & H where column D contains all rows (Minmimum of column A) , E contains ( Max value of A), G (Contains min of couln c) , H (Contains max of column C).

Iam using ICEMAN/ ICETOOL to perform the above but iam getting to work for one field . Please find the code below . Please do let me know what i need to change to have the aove format . Since formating is pending in JCL . first iam looking to develop the output file .
Code:

//test1as JOB (T,TST,test),'ICEMAN  ',MSGCLASS=Q,MSGLEVEL=(1,1),
//             REGION=0K,CLASS=F,NOTIFY=&SYSUID
//STEP0010 EXEC PGM=ICEMAN                           
//*                                                   
//SORTIN    DD DSN=testin.INPUT.FILE,DISP=SHR   
//*                                                   
//SORTOUT   DD DSN=&&S1,DISP=(,PASS),                 
//             UNIT=SYSDA,SPACE=(TRK,(1,1))           
//*                                                   
//SYSIN     DD *                                     
      SORT FIELDS=(1,4,ZD,A,11,4,ZD,A)          (  A, C)  positions)             
      OUTFIL REMOVECC,NODETAIL,OUTREC=(80X),         
      HEADER1=('MINKEY1,''',1,4,''''),               
      TRAILER1=('MAXKEY1,''',1,4,''''),               
      HEADER2=('MINKEY2,''',11,4,''''),               
      TRAILER2=('MAXKEY2,''',11,4,'''')               
/*                                                   
//*                                                   
//SYSPRINT  DD SYSOUT=*
//STEP0020 EXEC PGM=ICEMAN                             
//*                                                   
//SORTIN    DD DSN=testin.INPUT.FILE,DISP=SHR     
//*                                                   
//SYMNAMES  DD DSN=&&S1,DISP=(OLD,PASS)               
//*                                                   
//MIN       DD SYSOUT=testout.out.file,disp=shr
//SORTOUT   DD SYSOUT=*                               
//*                                                   
//SYSIN     DD *                                       
      SORT FIELDS=(1,4,ZD,A,11,4,ZD,A)                 
      OUTFIL FNAMES=MIN,INCLUDE=(1,4,CH,EQ,MINKEY1,or,
                                 1,4,CH,EQ,MAXKEY1,OR,
                                 11,4,CH,EQ,MINKEY2,OR,
                                 11,4,CH,EQ,MAXKEY2)   
     

//NEXT STEP TO FORMAT THE INPUT FILE by taking corresponding
values from postion in Min output file created in step20.

its working one field .

Iam have using ICETOOL using ON option for two different
fileds using one control card but this is not
working for 2 fields .


Can any one please help me.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Aug 13, 2012 10:06 pm
Reply with quote

balaji81_k,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                               
----+----1----+----2----+----3----+----4----+----5----+----6--
0009  XXXX    1400                                           
0005  XXXX    1000                                           
0047  XXXX    3000                                           
0016  XXXX    0500                                           
0081  XXXX    1200                                           
//SORTOUT  DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)     
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                       
  TRAILER1=('MINA,C''',MIN=(01,4,ZD,M11,LENGTH=4),'''',/,     
            'MAXA,C''',MAX=(01,4,ZD,M11,LENGTH=4),'''',/,     
            'MINC,C''',MIN=(15,4,ZD,M11,LENGTH=4),'''',/,     
            'MAXC,C''',MAX=(15,4,ZD,M11,LENGTH=4),'''')       
//*                                                           
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SYMNAMES DD DSN=&&S,DISP=SHR                               
//SORTIN   DD *                                               
0009  XXXX    1400                                           
0005  XXXX    1000                                           
0047  XXXX    3000                                           
0016  XXXX    0500                                           
0081  XXXX    1200                                           
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                           
  INCLUDE COND=(01,4,CH,EQ,MINA,OR,                           
                01,4,CH,EQ,MAXA,OR,                           
                15,4,CH,EQ,MINC,OR,                           
                15,4,CH,EQ,MAXC)                             
                                                             
  INREC OVERLAY=(22:MINA,3X,MAXA,3X,MINC,3X,MAXC)             
//*


The output from this job is
Code:

0005  XXXX    1000   0005   0081   0500   3000
0047  XXXX    3000   0005   0081   0500   3000
0016  XXXX    0500   0005   0081   0500   3000
0081  XXXX    1200   0005   0081   0500   3000
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Tue Aug 14, 2012 5:15 pm
Reply with quote

Hi Skolusu,

Many Many Thanks for you . JCL is working fine .


Thanks a lot .


Balaji K
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top