Hi,
How to convert a FB file to a VB file in COBOL.This was asked in one of the interview. I'm not sure how to do it. Can some one please assist.
Converting FB to VB file and vice versa?
- Robert Sample
- Global Moderator
- Posts: 1885
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Converting FB to VB file and vice versa?
You'll need two files, one FB input and one VB output file. IIRC, you will need to use RECORD CONTAINS in your FD and specify the record length for each record before the WRITE statement or you'll just get another FB file on output, even though your code indicates VB.
Re: Converting FB to VB file and vice versa?
Thanks Robert. But how do we instruct COBOL about RDW, as you said writing length - but what is the syntax?
WRITE WS-LENGTH? Where WS-LENGTH is defined as COMP S9(4)?
WRITE WS-LENGTH? Where WS-LENGTH is defined as COMP S9(4)?
- Robert Sample
- Global Moderator
- Posts: 1885
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Converting FB to VB file and vice versa?
You cannot directly use the RDW. However, if you specify you can then move the record length to <ws-variable> before doing the WRITE and the RDW value will be taken from <ws-variable>. You still need OCCURS DEPENDING ON or multiple 01 definitions with different lengths in your FD, however.
Code: Select all
RECORD VARYING FROM <low> TO <high> CHARACTERS DEPENDING ON <ws-variable>
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute