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

DFSORT/ICETOOL question


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

New User


Joined: 29 Jan 2014
Posts: 8
Location: USA

PostPosted: Sat May 31, 2014 12:40 am
Reply with quote

Hi,

I am attempting to:

1. Sort and split 'IN' file into the two output files as shown.
2. Write the existing header to each of the two output files.
3. Plug a fixed value of 'ABC' into the header of OT1.
4. Plug a fixed value of 'XYZ' into the header of OT2.

IN:
HEADER 000
1111111 B06
2222222 B05 006
3333333 B04 006
4444444 B03
5555555 B02 006
6666666 B01

OT1:
HEADER ABC
6666666 B01
4444444 B03
1111111 B06

OT2:
HEADER XYZ
5555555 B02 006
3333333 B04 006
2222222 B05 006


The JCL for my initial attempt is below, but discovered duplicate OUTREC statements are not allowed.

I was able to accomplish my goal - but with two separate steps. Just wondering if there was a way to get it done in one step.


//SPLIT EXEC PGM=ICETOOL
//IN DD DSN=&HLQ..IN,DISP=SHR
//OT1 DD DSN=&HLQ..OT1,
// DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1),RLSE)
//OT2 DD DSN=&HLQ..OT2,
// DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1),RLSE)
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) USING(OUTA)
/*
//OUTACNTL DD *
SORT FIELDS=(9,3,CH,A,1,7,CH,A)
OUTFILE FNAMES=(OT1),
INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C' ')
OUTREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
OVERLAY=(17:C'ABC'))
OUTFILE FNAMES=(OT2),
INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C'006')
OUTREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
OVERLAY=(17:C'XYZ'))
/*
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat May 31, 2014 3:27 am
Reply with quote

You have fallen into the trap of becoming confused by OUTREC and OUTREC on OUTFIL. Two different things.

On OUTFIL, use BUILD instead of OUTREC, and you need a continuation comma as the last of each line before each BUILD.
Back to top
View user's profile Send private message
John W Perry

New User


Joined: 29 Jan 2014
Posts: 8
Location: USA

PostPosted: Sat May 31, 2014 4:40 am
Reply with quote

Thanks for your help Bill,

The use of BUILD worked fine.

I've also added a COPY step to produce two more output files in the original sort order. The process works OK but I was wondering if it could be accomplished with just one pass on the input file.

Code:
//TOOLIN   DD *                                           
  SORT FROM(IN) USING(OUTA)                               
  COPY FROM(IN) USING(OUTB)                               
/*                                                       
//OUTACNTL DD *                                           
 SORT FIELDS=(9,3,CH,A,1,7,CH,A)                         
  OUTFILE FNAMES=(OT1),                                   
    INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C'   '),   
     IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                 
             BUILD=(1,16,C'ABC'))                         
  OUTFILE FNAMES=(OT2),                                   
    INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C'006'),   
     IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                 
             BUILD=(1,16,C'XYZ'))                         
/*                                                       
//OUTBCNTL DD *                                           
  OUTFILE FNAMES=(OT3),                                   
    INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C'   '),   
     IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                   
             BUILD=(1,16,C'ABC'))                         
  OUTFILE FNAMES=(OT4),                                   
    INCLUDE=(1,6,CH,EQ,C'HEADER',OR,13,3,CH,EQ,C'006'),   
     IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),                   
             BUILD=(1,16,C'XYZ'))                         
/*


Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 05, 2014 4:32 am
Reply with quote

Sorry John, just found this in the HomeWork part of the forum, which isn't somewhere questions appear from (I thought it had been deleted after my answer).

If you want the output sorted and in the original order, you will have to do it in separate operations, as you have done already. OUTFIL (or after OUTREC, if no OUTFIL present) is where data is written, and the input is long gone by that point.

The one thing you could try is to use an E15 exit, which can be written in COBOL. You will be presented with each record from the input, which you can then format and write to new files, from the COBOL program. Whether you data and the number of files you require means that this will use fewer resources is going to be down to experimentation.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top