Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
mrgnndhmk

New User


Joined: 01 Feb 2006
Posts: 46
Location: India

PostPosted: Wed Sep 11, 2013 4:04 pm    Post subject: VSE: Converting FB Flat file to VB Flat File using SORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Sep 11, 2013 4:36 pm    Post subject: Reply to: VSE: Converting FB Flat file to VB Flat File using
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: 46
Location: India

PostPosted: Wed Sep 11, 2013 4:49 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Sep 11, 2013 6:12 pm    Post subject: Reply to: VSE: Converting FB Flat file to VB Flat File using
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: 46
Location: India

PostPosted: Wed Sep 11, 2013 6:22 pm    Post subject:
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

Site Director


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

PostPosted: Wed Sep 11, 2013 7:17 pm    Post subject:
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: 46
Location: India

PostPosted: Wed Sep 11, 2013 11:45 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Sep 11, 2013 11:57 pm    Post subject: Reply to: VSE: Converting FB Flat file to VB Flat File using
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

Site Director


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

PostPosted: Thu Sep 12, 2013 1:11 am    Post subject:
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: 46
Location: India

PostPosted: Thu Sep 12, 2013 7:18 am    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Sep 20, 2013 1:25 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us