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

VSE: Converting FB Flat file to VB Flat File using SORT


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 51
Location: India

PostPosted: Wed Sep 11, 2013 4:04 pm
Reply with quote

Hi,

We do not have DFSORT in our Mainframe.

The requirement is we have a FB Flat file which we want to convert to VB Flat file in order to use it in a Generic COBOL program to process.

Our SORT is working fine if the Input file is VSAM (ESDS) and output file is Flat file. But Flat file to Flat file is failing.

Any help is greatly appreciable.

FB Record Length is 200. We use Output BLKSIZE as 804 considering 4 records per block (4 * 200 = 800 + 4 (VB))

I tried different combinations of Block size but still failing with the error

CASD203E WRONG LENGTH RECORD 03597

Code:

// DLBL    SORTIN1,'REMITS.WITHOUT.NULL.NONF',O               
// DLBL    SORTOUT,'REMITS.WITHOUT.NULL.VARF',N,T=150,HOLD     
// EXEC    PROC=SORTWORK    IO                                 
// EXEC    SORT,SIZE=3M                                       
 OPTION PRINT=CRITICAL,ROUTE=LOG,FILNM=(,)                     
 SORT FIELDS=COPY,EQUALS,FILES=1,WORK=1                       
 RECORD TYPE=V,LENGTH=200                                     
 INPFIL BLKSIZE=27800                                         
 OUTFIL BLKSIZE=804                                         
 END                                                           
/*                                                             


Thanks,
Muru
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 4:36 pm
Reply with quote

If you don't have DFSORT, please don't post in the DFSORT forum.

You need to show the output messages, from the successfull ESDS step amd the unsuccessfiul sequential file.
Back to top
View user's profile Send private message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 51
Location: India

PostPosted: Wed Sep 11, 2013 4:49 pm
Reply with quote

These are the logs received. Would these help to suggest?

Successful:
Job:
Code:

// EXEC    PROC=PVAND688                                     
// DLBL    SORTOUT,'REMITS.WITHOUT.NULL.VARF',N,T=150,HOLD   
// EXEC    PROC=SORTWORK    IO                               
// EXEC    SORT,SIZE=3M                                     
 OPTION PRINT=CRITICAL,ROUTE=LOG,FILNM=(,VAND688)           
 MERGE FIELDS=COPY                                           
 RECORD TYPE=V,LENGTH=200                                   
 INPFIL VSAM                                                 
 OUTFIL BLKSIZE=804                                         
 END                                                         
/*                                                           


Output:
Code:

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0                 
COMPUTER ASSOCIATES                     CA-SORT 9.0          11 SEP 2013   4.15.02
CASD000I OPTION FILNM=(VAND688)                                                   
CASD000I MERGE FIELDS=COPY,FILES=1,WORK=1                                         
CASD000I RECORD TYPE=V,LENGTH=200                                                 
CASD000I INPFIL BLKSIZE=2004                                                       
CASD000I OUTFIL ESDS,TOL                                                           
CASD000I END                                                                       
CASD071I STORAGE USED= 07339264                                                   
CASD021W SORTIN1 ASSGN INCOMPAT                                                   
CASD094I SORTIN1 DISK DTF GENERATED                                               
CASD096I VAND688 VSAM ACCESS USED                                                 
CASD069I NO SEVERE ERRORS                                                         
CASD201I RCD IN      13714,OUT      13714                                         
CASD212I CA-SORT END                                                               


UnSuccessful:

Job:
Code:

// DLBL    SORTIN1,'REMITS.WITHOUT.NULL.NONF',O                 
// DLBL    SORTOUT,'REMITS.WITHOUT.NULL.VARF',N,T=150,HOLD     
// EXEC    PROC=SORTWORK    IO                                 
// EXEC    SORT,SIZE=3M                                         
 OPTION PRINT=CRITICAL,ROUTE=LOG,FILNM=(,)                     
 SORT FIELDS=COPY,EQUALS,FILES=1,WORK=1                         
 RECORD TYPE=V,LENGTH=200                                       
 INPFIL BLKSIZE=27800                                           
 OUTFIL BLKSIZE=804                                             
 END                                                           
/*                                                             


Output:
Code:

F7 0007 CASD203E WRONG LENGTH RECORD 03597                                 
F7 0007 0S06I A DUMP MACRO WAS ISSUED                                     
F7 0007 0S00I JOB EDI410DV CANCELED                                       
F7 0007 0S07I PROBLEM PROGRAM  PSW = 076D0000 80605B96                     
F7 0007 0S29I DUMP STARTED                                                 
F7 0001 1Q52I  OUTPUT LIMIT EXCEEDED FOR EDI410DV 60305 F7,00E, WITH 15000
        RECORDS                                                           
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 6:12 pm
Reply with quote

I asked for the information assuming that it would be of help, yes.

For the unsuccessful step, you've shown the joblog only. However, this is the problem:

Code:
CASD203E WRONG LENGTH RECORD 03597


Hit your CA-SORT manual for this message. I don't know whether it is showing the length or the record-number, but it looks like you have a record which is longer than 200 bytes of data.


You specify TYPE = V but state that the records are fixed-length. Decide on one or the other. If fixed, use TYPE=F and drop the extra four bytes from the output blocksize.

The two things are probably connected. If the data is fixed-lenght, but you are telling CA-SORT it is variable, CA-SORT will attempt to use the first four bytes of the data as the RDW, which is hardly likely to be a good thing.

CA-SORT and VSE in one post. May be unique on this forum :-)
Back to top
View user's profile Send private message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 51
Location: India

PostPosted: Wed Sep 11, 2013 6:22 pm
Reply with quote

Thanks Bill for the details & suggestions

In the present state, the file is created as Fixed length by the COBOL program and used as Fixed length.

In the new state, we want the Fixed Length output from the COBOL program to be fed into another COBOL program which requires it to be a Variable length file.

Therefore, I am trying to introduce a SORT step between the two COBOL programs, to convert this Fixed length file into Variable length file.

We are using CA SORT in the VSE environment.

As you suggested, I will try to see the manual for CA SORT and get back.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 7:17 pm
Reply with quote

Hello,

Just curious . . .

If the file is created as FB why not simply use it as FB?

There should be no need to change it to VB. If there is a generic program that reads several formats of data, this can be accomplished with FB data as well. Long ago i wrote a generic file compare (that does i bit more than the standard compare) and i set it up to handle FB data up to 8k in length.
Back to top
View user's profile Send private message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 51
Location: India

PostPosted: Wed Sep 11, 2013 11:45 pm
Reply with quote

Hi,

I am interested to know how this can be handled with the FB file itself.

I assume, with the use of SORT & OUTREC for PAD & CLIP.

The FB to VB & Vice Versa work if VSAM is either Input or Output.

Unfortunately, sometimes we cannot stand our approaches but to follow the given requirements.

I checked the CA SORT Manual but could not find specific to this.

Regards,
Muru
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 11:57 pm
Reply with quote

With DFSORT on z/OS you'd be looking to FTOV on OUTFIL.

However, I have no idea what is available on CA-SORT on z/VSE.

If you register at the CA Website, you can probably ask for adivce, which will come either from a CA "community" or CA Support staff.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 12, 2013 1:11 am
Reply with quote

Hello,

Quote:
I am interested to know how this can be handled with the FB file itself.
There is not much to it. It is neither fancy nor tricky.

Code:
    SELECT FLATFLA    ASSIGN TO UT-S-FLATFLA.   
    SELECT FLATFLB    ASSIGN TO UT-S-FLATFLB.   

FD  FLATFLA                                                 
    LABEL RECORDS ARE STANDARD                             
    RECORDING MODE IS F                                     
    BLOCK CONTAINS 0                                       
    RECORD CONTAINS 0 CHARACTERS                           
    DATA RECORD IS FLAT-FILE-A-REC.                         
01  FLAT-FILE-A-REC                        PIC X(32000).   
                                                           
FD  FLATFLB                                                 
    LABEL RECORDS ARE STANDARD                             
    RECORDING MODE IS F                                     
    BLOCK CONTAINS 0                                       
    RECORD CONTAINS 0 CHARACTERS                           
    DATA RECORD IS FLAT-FILE-B-REC.                         
01  FLAT-FILE-B-REC                        PIC X(32000).   

    OPEN INPUT FLATFLA.       
    OPEN INPUT FLATFLB.       
 


The READS are just a READ INTO.

Actually i lied earlier - the code has been expanded to handle up to 32k rather than only 8k . . . icon_cool.gif
Back to top
View user's profile Send private message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 51
Location: India

PostPosted: Thu Sep 12, 2013 7:18 am
Reply with quote

Thanks d.sch.

I will use this idea when I get the chance.

Thanks,
Muru
Back to top
View user's profile Send private message
Scott Lippincott

New User


Joined: 07 May 2010
Posts: 2
Location: Philadelphia, PA

PostPosted: Fri Sep 20, 2013 12:58 am
Reply with quote

Each RECORD in a variable file has a 4-byte binary RDW. The RDW value includes the length of the RDW. (so a variable record with 200 bytes of data is 204 bytes long)

The first two bytes of the RDW are the binary length of the record (including the RDW) followed by two bytes of binary zeros. (almost always, but lets not go there; its irrelevant) The RDW value for a 204 byte record (RDW + 200 bytes of data) is therefore x'00CC0000'.

When blocked, each block has one 4-byte BDW (first 4 bytes of the block); followed by as many records fit in the block. Records may be different sizes, but must fit in the block. (BDW must be at least 4 bytes larger than your maximum RDW)

The BLKSIZ of four 200-byte fixed records in a variable block is:
((Data length + RDW length) * blocking factor) + BDW length)
((200+4)*4)+4 = 820 NOT 804


1. VSAM is always variable length internally, so variable to variable is not a problem.
2. I believe you will find that your fixed file contains x'0E0D' where CA-SORT expects your RDW to be. (first two bytes) (decimal 3597)
3. I don't currently have access to a CA-SORT manual, but I have previously used INREC to build variable records from fixed records in SYNCSORT and DFSORT. You should be able to create an RDW for your file using either INREC or OUTREC to insert the RDW into the beginning of the record.

Something like the following should work:
INREC FIELDS=(X'00CC0000',1,200)


Note: Dick's example above is coded for MVS/OS390/zOS. LRECL and BLKSIZ are obtained from JCL or the catalog. (not the program) I don't remember being able to do this in VSE.

I hope this helps.

P.S. I hope you are not in the practice of using such small block sizes. It's VERY inefficient. While this has recently become less of an issue with "virtual" hardware, your blocks should be sized to use the device efficiently (emulated/virtual or not) There are many calculators out there on the 'net, so find out what devices you have and use one. Your jobs will run MUCH faster. (wall time)

Short explanation:
When your job gets its' next time slice, you will run out of data before you run out of time. You get swapped out until your next turn. Default of 5 buffers(blocks of data) * records/block gets you swapped out every (blocking factor * 5 records). Better to use your entire time slice, and not process all of your data than the other way around. Overall, this also reduces the overhead of all of that (unnecessary) swapping that the O/S is doing.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Sep 20, 2013 1:25 am
Reply with quote

Scott Lippincott wrote:


Something like the following should work:
INREC FIELDS=(X'00CC0000',1,200)


Not with DFSORT or SyncSort it won't.

The only possible source of an RDW in INREC or OUTREC or OUTFIL is another RDW.

You can make fixed-length records variable, with FTOV on OUTFIL (probably VLTRIM would be useful as well).

You cannot just put values in positions 1-4 of a record and expect it to become variable.
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 -> SYNCSORT

 


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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top