Joined: 03 May 2010 Posts: 13 Location: Malvern PA
Hello,
I have seen many excellent examples of how to create a VB file from a FB file , with the option to remove trailing blanks or spaces.
I have been struggling with how to create a VB file from a FB file that has the record length of the VB output file specified on the value of a 2 byte binary field in column 2 plus the first column/character.
For example
the input dsn is FB LRECL-12224
Code:
record 1 is
----+----1----+----2----+----3----+----4----+----5----+----6
!..LyF...CPRESLIB
501DAC000CDDCEDCC44444444444444444444444444444
A003860003795239200000000000000000000000000000000
Record 2
----+----1----+----2----+----3----+----4----+----5----+----6
!..LÓÓ...Created by Compart MFFAFP IO Filter
502DEE000C988A8848A4C99989A4DCCCCD4CD4C89A894444444
A0B3EE0003951354028036471930466167096069335900000000000
the output file is VB and each record contains the number of columns as specified in the binary value in columns positions 2 and 3 plus 1
so for these two records the VB output file (excluding RDW) would look like...
rec 2
!..LÓÓ...Created by Compart MFFAFP IO Filter
502DEE000C988A8848A4C99989A4DCCCCD4CD4C89A89
A0B3EE00039513540280364719304661670960693359
That is, record 1 of the VB file has the data from record one of the FB file but for a length of x'0010' (16 bytes as specified in col 2/3) plus the first character . so the first record of the VB file would be the first 17 bytes of the FB file.
For record 2 of the VB file the length in col2/3 is x'002B' (43 bytes) plus the first byte . So this record of the VB file would be the first 44 bytes of the FB file.
and so on for eack record of the FB file.
Can this be done using ICETOOL or SORT ?
If so could you please provide an example ?
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
Sorry for the bad cut and paste in the original question...
here again ...
Input file .... records 1 and 2 from input file DCB=FB LRECL=12224
[img]----+----1----+----2----+----3----+----4----+----5-
******************************** Top of Data ******
! :LyF CPRESLIB
501DAC000CDDCEDCC444444444444444444444444444444444
A00386000379523920000000000000000000000000000000000
--------------------------------------------------
! :LÓÓ Created by Compart MFFAFP IO Filter
502DEE000C988A8848A4C99989A4DCCCCD4CD4C89A8944444
A0B3EE000395135402803647193046616709606933590000000
output file should be VB LRECL=12224 the output file is VB and each record contains the number of columns as specified in the binary value in columns positions 2 and 3 plus 1
That is, record 1 of the VB file has the data from record one of the FB file but for a length of x'0010' (16 bytes as specified in col 2/3) plus the first character . so the first record of the VB file would be the first 17 bytes (x'0011') of the FB file.
For record 2 of the VB file the length in col2/3 is x'002B' (43 bytes) plus the first byte . So this record of the VB file would be the first 44 bytes (x'002C') of the FB file.
and so on for each record of the FB file.
Can this be done using ICETOOL or SORT ?
If so could you please provide an example ?
nickciancio,
You can't change RDW to RDW+1 without impacting data. You can't update RDW as well. When you change to RDW+1, system treats RDW+1 position as a part of record. Would you be ok, adding a trailing zero while converting to VB?
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
Hello,
Yes, I do not want trailinig blanks removed. I guess I should have selected a better example other than the first two records.
Here is a record from the FB input that has a x'0028' in position 2/3 specifying a length of 40 characters.
[img]
!..LÓÓ...1:54962M
502DEE000F7FFFFFD44444444444444444444444444444444
A083EE0001A54962400000000000000000000000000000000
the VB output file would have the first character (x'5A') plus the next 40 characters. Which for this record would have trailing blanks.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Nick,
You seem to have your file coming from Compart DocBridge. Have you tried contacting them? Or did you look at the file, notice the length embedded in the record and decide to give it a go?
With recent requests for proprietary files, people have assumed that we have some wand we can wave to get the data out accurately. At least you have done the wand-work.
If you can explain the background to the file, solutions (straight forward) can be found in other languages (Assmbler, Cobol, Easytrieve, PL/I), but I'm sure you know that anyway.
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
Frank,
the FB file is created from JES2 AFP sysout files using the JES2 SAPI interface. The goal was to create one large file that collected many (several thousand) small JES2 sysouts. The SAPI app creates the FB file , the sysout as it resides on JES2 is V, We can use IEBGENER to place the FB file back on the JES2 spool but the sysout uses an inordinate amount of spool space due to the fact that most records contain a lot of spaces.
I converted the FB file to VB and IEBGENER'd the VB file to JES2 as VBA and it removed all trailing spaces but this cause PSF to generate error APS114I.. because some records were to have additional blanks.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
nickciancio,
An exit be an efficient tool in here to create the VB records. Compile and link edit the following cobol E15 exit. The cobol exit basically checks the length and fills the other bytes with a constant character '|' which will be used a Trim character while converting to VB file. If your input has the character '|' then change that constant to some other value. ex : $,#,%,... and change the VLTRIM character in sort step.
LINKAGE SECTION.
01 RECORD-FLAGS PIC 9(8) BINARY.
88 FIRST-REC VALUE 00.
88 MIDDLE-REC VALUE 04.
88 END-REC VALUE 08.
01 IN-REC PIC X(12224).
01 OUT-REC PIC X(12224).
PROCEDURE DIVISION USING RECORD-FLAGS
, IN-REC
, OUT-REC.
IF END-REC
MOVE 8 TO RETURN-CODE
ELSE
MOVE IN-REC TO WS-REC
MOVE FILL-REC TO WS-REC(WS-LEN + 2 : )
MOVE WS-REC TO OUT-REC
MOVE 20 TO RETURN-CODE
END-IF
GOBACK.
Now run this DFSORT step which will give you the desired results
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
I;m sure that your will outperfrom the rexx exec.
And if the files are very large, this may cause a problem.
Suggest you also implement the "exit" solution for 2 reasons:
1. it may make this process perform accdeptably if the rexx does not.
2. it would be a handy tool to have in your toolkit for future opportunities.
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
Hi,
I have come up with a solution using DFSORT and yes it's probably not as efficient as the EXIT provided by Kolosu but just thought I might share the solution.