|
View previous topic :: View next topic
|
| Author |
Message |
nickciancio
New User
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...
| Code: |
----+----1----+----2----+----3----+----4----+----5--
!..LyF...CPRESLIB
501DAC000CDDCEDCC
A0038600037952392
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 ?
Thanks in advance.
Nick Ciancio
Siemens Med |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It is not clear why your "bottom line" has more values that the "top line".
If you re-post using the copy/paste from your screen and then apply the Code tag, i'll delete the original. |
|
| Back to top |
|
 |
nickciancio
New User
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 ?
[/u][/quote] |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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?
Thanks, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
nickciancio,
Are you sure you don't just have trailing blanks that need to be removed? It's difficult to tell from your examples. |
|
| Back to top |
|
 |
nickciancio
New User
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.
!..LÓÓ...1:54962M
502DEE000F7FFFFFD444444444444444444444444
A083EE0001A549624000000000000000000000000
Let me know if this helps.
Regards Nick[/img] |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| DFSORT does NOT have any built-in functions for doing what you want. |
|
| Back to top |
|
 |
nickciancio
New User
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
|
|
|
|
Thanks Frank....I may have to write a rexx exec or asm ogm to do it..
Thanks..
Nick |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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.
Edit: Sorry Nick, crossed with your reply. |
|
| Back to top |
|
 |
nickciancio
New User
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.
O well ... back to the drawing board.
Nick |
|
| Back to top |
|
 |
Skolusu
Senior Member
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.
| Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. BLDRDW.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-REC.
05 WS-IND PIC X(1).
05 WS-LEN PIC S9(04) COMP.
05 FILLER PIC X(12221).
01 FILL-REC PIC X(12224) VALUE ALL '|'.
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
| Code: |
//STEP0100 EXEC PGM=SORT,PARM='MSGDDN=DFSOUT'
//EXITC DD DSN=your cobol load lib,DISP=SHR
//DFSOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your FB 12224 input file,DISP=SHR
//SORTOUT DD DSN=Your VB file with varying len,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
MODS E15=(BLDRDW,12224,EXITC,C)
OUTFIL FTOV,VLTRIM=C'|'
//* |
|
|
| Back to top |
|
 |
nickciancio
New User
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
|
|
|
|
Thank you for the sample program.
I have written a rexx exec to perform the same function biy I;m sure that your will outperfrom the rexx exec. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 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. |
|
| Back to top |
|
 |
nickciancio
New User
Joined: 03 May 2010 Posts: 13 Location: Malvern PA
|
|
|
|
| I agree. Once angain...Thank You! |
|
| Back to top |
|
 |
gcicchet
Senior Member
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.
| Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&IFTHEN,
// DISP=(,PASS,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(50,10),RLSE)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REPEAT=00079,IFOUTLEN=080,
IFTHEN=(WHEN=INIT,
BUILD=(15:C'IFTHEN=(WHEN=(130,5,ZD,EQ,+',SEQNUM,5,ZD,START=01,
C'),BUILD=(1,',SEQNUM,5,ZD,START=02,C')),')),
IFTHEN=(WHEN=(042,5,ZD,EQ,+00001),
OVERLAY=(1:C' OUTFIL FTOV,')),
* THIS MUST EQUAL REPEAT
* |
* V
IFTHEN=(WHEN=(042,5,ZD,EQ,+00079),OVERLAY=(65:C' '))
/*
//**********************************************************************
//*
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
! LÓÓ 1:54962MABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
! LÓÓ 1:54962M
! LÓÓ 1:54962M
/*
//SORTOUT DD DSN=output-file,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(10,5),RLSE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:2,2,HEX)),
IFTHEN=(WHEN=(81,1,CH,GE,C'0'),
OVERLAY=(086:C'000',81,1),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,GE,C'0'),
OVERLAY=(091:C'000',82,1),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,GE,C'0'),
OVERLAY=(096:C'000',83,1),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,GE,C'0'),
OVERLAY=(101:C'000',84,1),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'A'),
OVERLAY=(086:C'0010'),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),
OVERLAY=(086:C'0011'),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'C'),
OVERLAY=(086:C'0012'),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'D'),
OVERLAY=(086:C'0013'),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'E'),
OVERLAY=(086:C'0014'),HIT=NEXT),
IFTHEN=(WHEN=(81,1,CH,EQ,C'F'),
OVERLAY=(086:C'0015'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'A'),
OVERLAY=(091:C'0010'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'B'),
OVERLAY=(091:C'0011'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'C'),
OVERLAY=(091:C'0012'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'D'),
OVERLAY=(091:C'0013'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'E'),
OVERLAY=(091:C'0014'),HIT=NEXT),
IFTHEN=(WHEN=(82,1,CH,EQ,C'F'),
OVERLAY=(091:C'0015'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'A'),
OVERLAY=(096:C'0010'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'B'),
OVERLAY=(096:C'0011'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'C'),
OVERLAY=(096:C'0012'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'D'),
OVERLAY=(096:C'0013'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'E'),
OVERLAY=(096:C'0014'),HIT=NEXT),
IFTHEN=(WHEN=(83,1,CH,EQ,C'F'),
OVERLAY=(096:C'0015'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'A'),
OVERLAY=(101:C'0010'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'B'),
OVERLAY=(101:C'0011'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'C'),
OVERLAY=(101:C'0012'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'D'),
OVERLAY=(101:C'0013'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'E'),
OVERLAY=(101:C'0014'),HIT=NEXT),
IFTHEN=(WHEN=(84,1,CH,EQ,C'F'),
OVERLAY=(101:C'0015'),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,GE,X'00'),
OVERLAY=(106:086,04,ZD,MUL,+4096,EDIT=(TTTTT),
112:091,04,ZD,MUL,+0256,EDIT=(TTTTT),
118:096,04,ZD,MUL,+0016,EDIT=(TTTTT),
124:101,04,ZD,EDIT=(TTTTT),
130:106,5,ZD,ADD,112,5,ZD,ADD,118,5,ZD,ADD,124,5,ZD,EDIT=(TTTTT)))
/*
// DD DSN=&&IFTHEN,
// DISP=SHR
|
the 3 SORTIN records with HEX on
| Code: |
! LÓÓ 1:54962MABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
502DEE000F7FFFFFDCCCCCCCCCDDDDDDDDDEEEEEEEEFFFFFFFFFF4444444444444444444
A083EE0001A5496241234567891234567892345678912345678900000000000000000000
-----------------------------------------------------------------------
! LÓÓ 1:54962M
502DEE000F7FFFFFD4444444444444444444444444444444444444444444444444444444
A0B3EE0001A5496240000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
! LÓÓ 1:54962M
503DEE000F7FFFFFD4444444444444444444444444444444444444444444444444444444
A0B3EE0001A5496240000000000000000000000000000000000000000000000000000000
|
Gerry |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|