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

Splitting one record in a file to 10 output files.


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

New User


Joined: 14 Aug 2018
Posts: 3
Location: usa

PostPosted: Tue Aug 21, 2018 8:51 pm
Reply with quote

I have a record(file is sequential) with first 100 bytes having general information and from 101 position for every 20 bytes the data will change(lay out is same) likely 10 segments are there.

Code:

File:
1------------100MMMMMYYYYYAAAAA


Here M, Y and A are fields which have 20 bytes a total of 10 segments like that.

I need to create 10 segments in one record to different 10 output files(one output file per segment)

If I create with more than 8 output files I'm seeing the error maximum output files reached.

So I had to create 7 files in one step and 3 in other step and later merging based on key(s).

Code:


//STEP030  EXEC PGM=FILEAID           
//SYSPRINT DD SYSOUT=*               
//SYSLIST  DD SYSOUT=*               
//SYSOUT   DD SYSOUT=Y               
//DD01     DD DSN=XXXXXX.YYYYYY.INPUT,DISP=SHR
//DD01A    DD DSN=SEG1,--->OUTPUT FILES       
//DD01B    DD DSN=SEG2,       
//DD01C    DD DSN=SEG3,       
//DD01D    DD DSN=SEG4,       
//DD01E    DD DSN=SEG5,       
//DD01F    DD DSN=SEG6,       
//DD01G    DD DSN=SEG7,       
$$DD01 USER IF=(81,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,101),
      MOVE=(13,10,81),MOVE=(23,09,01),MOVE=(32,10,91),       
      MOVE=(42,01,103),W=DD01A,                             
            IF=(104,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,124),
      MOVE=(13,10,104),MOVE=(23,09,01),MOVE=(32,10,114),     
      MOVE=(42,01,126),W=DD01B,                             
            IF=(127,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,147),
      MOVE=(13,10,127),MOVE=(23,09,01),MOVE=(32,10,137),     
      MOVE=(42,01,149),W=DD01C,                             
            IF=(150,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,170),
      MOVE=(13,10,150),MOVE=(23,09,01),MOVE=(32,10,160),     
      MOVE=(42,01,172),W=DD01D,                             
            IF=(173,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,193),
      MOVE=(13,10,173),MOVE=(23,09,01),MOVE=(32,10,183),     
      MOVE=(42,01,195),W=DD01E,                             
            IF=(196,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,216),
      MOVE=(13,10,196),MOVE=(23,09,01),MOVE=(32,10,206),     
      MOVE=(42,01,218),W=DD01F,                             
            IF=(219,NE,C' '),MOVE=(01,10,49),MOVE=(11,2,239),
      MOVE=(13,10,219),MOVE=(23,09,01),MOVE=(32,10,229),     
      MOVE=(42,01,241),W=DD01G                               


Can you please suggest me how to do this in one step(splitting into 10 files in one step) instead of 2 steps.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 21, 2018 9:02 pm
Reply with quote

mf_123,

Welcome to the forums, Since you posted in DFSORT forum, I believe you are looking for a DFSORT equivalent of your file-aid batch process here.

Look for examples with OUTFIL FILES or OUTFIL FNAMES where you can have multiple outputs and use BUILD=(starting pos,length,....) to determine which fields should be written to each output. Good luck.
Back to top
View user's profile Send private message
mf_123

New User


Joined: 14 Aug 2018
Posts: 3
Location: usa

PostPosted: Tue Aug 21, 2018 9:28 pm
Reply with quote

Arun Raj wrote:
mf_123,

Welcome to the forums, Since you posted in DFSORT forum, I believe you are looking for a DFSORT equivalent of your file-aid batch process here.

Look for examples with OUTFIL FILES or OUTFIL FNAMES where you can have multiple outputs and use BUILD=(starting pos,length,....) to determine which fields should be written to each output. Good luck.


Thanks Arun. I also need to validate a segment is not empty(the first field in a segment) only then I need to write into output file.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Aug 21, 2018 9:47 pm
Reply with quote

If you are using File Aid, there is a MAXOUT (MO) option to override the default 8 output datasets -- MAXOUT can be as many as 99.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 21, 2018 10:56 pm
Reply with quote

Quote:
Thanks Arun. I also need to validate a segment is not empty(the first field in a segment) only then I need to write into output file.
You could add an INCLUDE parameter in each OUTFIL to check this. Or if you are trying to fix the file-aid batch, try what Robert has suggested.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Aug 22, 2018 5:14 am
Reply with quote

Up to 99 output files/datasets:
Code:

//STEP030  EXEC PGM=SORT   
//*               
//SYSOUT   DD SYSOUT=Y 
//*           
//SORTIN  DD  DDNAME=DD01
//*
//DD01     DD DSN=XXXXXX.YYYYYY.INPUT,DISP=SHR
//*
//DD01A    DD DSN=SEG1,--->OUTPUT FILES       
//DD01B    DD DSN=SEG2,       
//DD01C    DD DSN=SEG3,       
//DD01D    DD DSN=SEG4,       
//DD01E    DD DSN=SEG5,       
//DD01F    DD DSN=SEG6,       
//DD01G    DD DSN=SEG7, 
//. . . . . . . . . . . . . . .
//DD01Z    DD DSN=SEG99, 
//*
//SYSIN     DD  *
 SORT FIELDS=COPY     
 OUTFIL FNAMES=DD01A,
        INCLUDE=(81,1,CH,NE,C' '),
        BUILD=(49,10,
              101,2,
               81,10,
               01,09,
               91,10,       
              103,01)
 OUTFIL FNAMES=DD01B,                             
        INCLUDE=(104,1,CH,NE,C' '),
        BUILD=(49,10,
               124,2,
              104,10,
               01,09,
              114,10,     
              126,01)                         
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 OUTFIL FNAMES=DD01Z,
        INCLUDE=(219,1,CH,NE,C' '),
        BUILD=(49,10,
              239,2,
              219,10,
               01,09,
              229,10,     
              241,01)
 END
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Aug 22, 2018 4:20 pm
Reply with quote

Mf_123, Welcome !
But you need to post in the correct section of this forum( or if don’t know then say it when you post ), people have to spend time based on assumptions that you require a DFSORT solution since it posted under DFSORT.

You have not asked DFSORT alternative no where in your posting so this should be moved over to the different section of this forum along with Relevant replies..
Back to top
View user's profile Send private message
mf_123

New User


Joined: 14 Aug 2018
Posts: 3
Location: usa

PostPosted: Wed Sep 19, 2018 12:02 am
Reply with quote

HI All,

Thanks for your suggestions I could do the above logic using fileaid using MAXOUT option.

However, the step which is splitting the one file into 10 files is throwing RC=8 when some of the output files have to be created empty.

Can I override the RC to "0" if its "08" because there are some 10 steps in the JCL which is overriding Job RC TO "08"

I could do if it is IEBGENER but using FileAid I need to do THE BELOW

IF MAXCC = 8 -
THEN -
SET MAXCC = 0
END


Can some one suggest on this.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Sep 19, 2018 12:26 am
Reply with quote

Contact the vendor to see if what you want to do is even possible. The File Aid manual states that return code 8 is set when "No records copied to the output dataset during a COPY, DROP or USER function" and further states that
Quote:
The decimal return codes issued by File-AID always reflect the highest error detected during execution.
So unless the vendor gives you a way to avoid this condition, you will be stuck with getting return code 8 when one (or more) output data sets are empty -- so your choices will be to live with the 8 or use a different program / utility other than File Aid to do what you want.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Sep 19, 2018 3:40 am
Reply with quote

mf_123 wrote:

I could do if it is IEBGENER but using FileAid I need to do THE BELOW

IF MAXCC = 8 -
THEN -
SET MAXCC = 0
END

Can some one suggest on this.

Those statements are specific to IDCAMS utility only.

This MAXCC is controlled within single IDCAMS step only. It has nothing to do neither with JCL, nor with other utilities, nor with other job steps.
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top