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

Split a VB file into two


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

New User


Joined: 18 Feb 2011
Posts: 3
Location: Bangalore

PostPosted: Fri Feb 18, 2011 5:05 pm
Reply with quote

Hi All,

Need your help,

I have an i/p VB file with rec length 124 and it is

0 HEADER
1 AAAAAAA
2 AAAAAAA 52 100
1 BBBBBBB
2 BBBBBBB 16 320
1 CCCCCCC
2 CCCCCCC 52 120
1 DDDDDDD
2 DDDDDDD 16 220
9 TRAILER 760

I need two o/p files based on '52' or '16' in 90th position and to add values in 100th position for trailer record

FILE A

0 HEADER
1 AAAAAAA
2 AAAAAAA 52 100
1 CCCCCCC
2 CCCCCCC 52 120
9 TRAILER 220

FILE B

0 HEADER
1 BBBBBBB
2 BBBBBBB 16 320
1 DDDDDDD
2 DDDDDDD 16 220
9 TRAILER 540
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 18, 2011 11:04 pm
Reply with quote

Arun Bharath,

Can the Trailer record be generated dynamically with text and summation?

What is the format of the field to be summed? Does all the records which have '2' in position 5 (since input is VB , your input actually starts from pos 5) have the field to be summed?

Did you consider the RDW when calculating the positions of records to be summed?

Are these groups of records? Each group starts with '1' in pos 5 and ends with a record of '2' ?
Back to top
View user's profile Send private message
Arun Bharath

New User


Joined: 18 Feb 2011
Posts: 3
Location: Bangalore

PostPosted: Sun Feb 20, 2011 10:15 pm
Reply with quote

Skolusu

Yes, I have considered the RDW and these are group of records start with '1' and end with '2'.

yes all the records start with '2' have the fields to be summed and the format of the field is S9(10)V99..

Yes the Trailer record can be generated dynamically with text and summation..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 22, 2011 2:52 am
Reply with quote

Here's a DFSORT job that will do what you asked for. Note that the IN1 DD and IN2 DD must both point to your input data set.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file (VB/124)
//IN2 DD DSN=...  input file (VB/124)
//OUT1 DD DSN=...  output file1 (VB/124)
//OUT2 DD DSN=...  output file2 (VB/124)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(7,7,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(5,7,A),SORTED
  OPTION COPY
  REFORMAT FIELDS=(F1:1,4,F2:13,2,F1:5)
  OUTFIL FNAMES=OUT1,REMOVECC,INCLUDE=(5,2,CH,EQ,C'52'),
    BUILD=(1,4,7),
   HEADER1=('0 HEADER'),
   TRAILER1=('9 TRAILER ',TOT=(102,12,ZD,TO=ZD,LENGTH=12))
  OUTFIL FNAMES=OUT2,REMOVECC,INCLUDE=(5,2,CH,EQ,C'16'),
    BUILD=(1,4,7),
   HEADER1=('0 HEADER'),
   TRAILER1=('9 TRAILER ',TOT=(102,12,ZD,TO=ZD,LENGTH=12))
/*
//JNF1CNTL DD *
  OMIT COND=(5,1,SS,EQ,C'09')
/*
//JNF2CNTL DD *
  INCLUDE COND=(5,1,CH,EQ,C'2')
  INREC BUILD=(1,4,5:7,7,13:90,2)
/*
Back to top
View user's profile Send private message
Arun Bharath

New User


Joined: 18 Feb 2011
Posts: 3
Location: Bangalore

PostPosted: Tue Feb 22, 2011 8:07 pm
Reply with quote

Thanks a lot icon_smile.gif
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 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