View previous topic :: View next topic
|
Author |
Message |
sudhirk63
New User
Joined: 08 Oct 2006 Posts: 19 Location: Bangalore
|
|
|
|
Hi,
I have a input file which is VB and has different record types and diferent lengths. The first four charactres of each record specifies the length.
The input file could be of as
0010aaaaaaaaaa
0020dddddddddddddddddddd
In the existing application this input file was taken and final file is now an FB file which has resulted in filling up the unused positions as spaces X'40'. The application has some 80 programs and hence I do not want to touch them.
However the application at the end creates a FB file with same length as input and this needs to be converted to VB.
Is there a utility by which I would be able to remove the spaces from unwanted position and convert the file back to VB given that I have lengths in the first 4 positions.
Or if I write a COBOL code to substring the record based on the lenght and write to the output VB file, be a right solution.
Thanks.
Sudhir |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not clear what you want.
The first FB input record has a length of 10 and 10 non-blank characters after the length.
The second record has a length of 20 and 20 non-blank characters after the length.
Do you want the VB output records to contain the RDW and just the non-blank characters, or the RDW, the length and the non-blank characters?
That is, do you want the VB output records to look like this:
Code: |
|RDW|aaaaaaaaaa
|RDW|dddddddddddddddddddd
|
or like this:
Code: |
|RDW|0010aaaaaaaaaa
|RDW|0020dddddddddddddddddddd
|
Also, does the length in the FB record always just include the non-blank characters, or can the length include trailing blanks. For example, could an FB input record look like this:
00101234567
with three trailing blanks included in the length? |
|
Back to top |
|
|
sudhirk63
New User
Joined: 08 Oct 2006 Posts: 19 Location: Bangalore
|
|
|
|
Hi Frank,
The FB file record contains the record length. The record length does not include the spaces after the record.
For example , the FB file is LRECL of 1000 but the record can have record length of 100, 300 and so on.
The problem which i am facing is that when I convert this FB file to VB and compare the original VB to the newly created VB file I get differences of trailing spaces after the record length.
I want to avoid the trailing space when the VB file is created out of FB, so that the two files compare as same.
Please let me know if I have not made my self clear.
Thanks.
Sudhir |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I understood what you were trying to do the first time you explained it.
What I didn't know and still don't know is whether you want to have the length value (e.g. 0010) from positions 1-4 of the FB input records in positions 5-8 of the VB output records. I thought I asked that question quite clearly, but you didn't answer it. So I'll show you how to get the VB file with and without that length value from the FB records.
If you want the length value in the VB records, you can use this DFSORT job:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/1000)
//SORTOUT DD DSN=... output file (VB/1004)
//SYSIN DD *
OPTION COPY
OUTFIL FTOV,VLTRIM=X'40'
/*
|
FTOV will convert from FB records to VB records.
VLTRIM=X'40' will remove the trailing blanks and adjust the RDW length accordingly.
For your example input records, the VB output records would be as follows. Len is the length in the first 2-bytes of the 4-byte RDW. Data starts in position 5 and contains the length value from the FB records followed by the non-blank characters from the FB records.
Code: |
Len Data
18 0010aaaaaaaaaa
28 0020dddddddddddddddddddd
|
If you don't want the length value in the VB records, you can use this DFSORT job:
Code: |
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/1000)
//SORTOUT DD DSN=... output file (VB/1000)
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(5,996),FTOV,VLTRIM=X'40'
/*
|
BUILD=(5,996) will remove the length value.
FTOV will convert from FB records to VB records.
VLTRIM=X'40' will remove the trailing blanks and adjust the RDW length accordingly.
For your example input records, the VB output records would be as follows. Len is the length in the first 2-bytes of the 4-byte RDW. Data starts in position 5 and contains the non-blank characters from the FB records but does not contain the length value from the FB records.
Code: |
Len Data
14 aaaaaaaaaa
24 dddddddddddddddddddd
|
Hopefully one of those is what you want. |
|
Back to top |
|
|
sudhirk63
New User
Joined: 08 Oct 2006 Posts: 19 Location: Bangalore
|
|
|
|
Frank,
Thanks for your help.
The keyword VLTRIM is the magic wand. I should be reading the documentation more closely.
Actually I will be needing both the solutions, to write the length and to skip writing the length.
Thanks.
Sudhir |
|
Back to top |
|
|
|