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

Write a Variable Block File


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 4:09 pm
Reply with quote

Hi all,

I have a requirement to sweep 8 db records and write them into a VB PS file.
I currently have file definition as:

Code:

 FD EXTRACT-FILE                                 
     RECORDING MODE V                             
     BLOCK CONTAINS 0 RECORDS                     
     LABEL RECORDS ARE STANDARD.                 
                                                 
 01  EXTFILE-REC                     PIC X(351). 


The problem im facing is, that not all records are having 351 bytes of data. Some have 28, some 100, some 200. when i write the record which has data of 28 bytes, rest bytes are spaces which consumes larger space. Is there a way by which the EXTFILE-REC takes space equal to the length of the record?? Please help.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 12, 2009 4:11 pm
Reply with quote

Explain to me how you know that there are spaces at the end of each shorter record.
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 4:17 pm
Reply with quote

expat wrote:
Explain to me how you know that there are spaces at the end of each shorter record.


In the PS, after doing HEX ON, at the end of the record, i can see the following....

Code:

MU002LNK...±                             
DEFFFDDD032844444444444444444444444444444
44002352210F00000000000000000000000000000


4 depicts its spaces.
0
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 12, 2009 4:23 pm
Reply with quote

Are you in EDIT or BROWSE ?
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 4:25 pm
Reply with quote

expat wrote:
Are you in EDIT or BROWSE ?


The file size is very large hence opens in BROWSE MODE only.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 12, 2009 4:36 pm
Reply with quote

make your output a variable length file. COBOL manual as well as umteen threads about variable length records.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 12, 2009 4:40 pm
Reply with quote

Is it all records, or only the ones with a length of 28 ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Feb 12, 2009 5:11 pm
Reply with quote

Use the RECORD VARYING clause in your COBOL FD for the file.
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 5:40 pm
Reply with quote

expat wrote:
Is it all records, or only the ones with a length of 28 ?


It is for all records which are lesser than 351 bytes.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Feb 12, 2009 5:50 pm
Reply with quote

Then I believe that Robert has given you a good place to start
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 5:53 pm
Reply with quote

Thank u all for looking into this...

Could you please give me a link where i can find some information on "RECORD IS VARYING clause". I looked into some manuals but could not find it.

The help is much appreciated. icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Feb 12, 2009 6:00 pm
Reply with quote

COBOL Language Reference in the manuals link at the top of the page.
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 Feb 12, 2009 9:44 pm
Reply with quote

Hello,

Quote:
Some have 28, some 100, some 200.
Is there a known number of record formats or could the length be "anything" up to 351?

How does the code know the actual length of the data?
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Thu Feb 12, 2009 9:46 pm
Reply with quote

dick scherrer wrote:
Hello,

Quote:
Some have 28, some 100, some 200.
Is there a known number of record formats or could the length be "anything" up to 351?

How does the code know the actual length of the data?


Hi,

I have 8 records with record length as:
111
111
73
351
77
185
115
115
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 12, 2009 9:52 pm
Reply with quote

Here are some Google results. You should be able to find what you're looking for in at least one or more article.

Watch the wraparound -

www.google.com/search?hl=en&as_q=&as_epq=record+is+varying+in+size&as_oq=&as_eq=&num=10&lr=&as_filetype=&ft=i&as_sitesearch=&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images

Regards,
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 12, 2009 9:56 pm
Reply with quote

Code:

 FD EXTRACT-FILE                                 
     RECORDING MODE V                             
     BLOCK CONTAINS 0 RECORDS                     
     LABEL RECORDS ARE STANDARD.                 
 01  EXTFILE-REC                     PIC X(351). 
 01  VARIABLE-REC.
   03  FILLER PIC X OCCURS 1 TO 351 TIMES DEPENDING ON WS-LENGTH.

 77 WS-LENGTH PIC S9(3) COMP-3.

 MOVE INPUT-LENGTH TO WS-LENGTH.
 MOVE INPUT-REC TO either EXTFILE-REC or VARIABLE-REC.
 WRITE VARIABLE-REC.
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: Fri Feb 13, 2009 12:36 am
Reply with quote

Hello,

Quote:
I have 8 records with record length as:
111
111
73
351
77
185
115
115
If there can only be these 8 record layouts (6 lengths actually), i'd suggest creating 8 level-01s in the FD and writing to the appropriate length level-01. Does each record have an identifier so that the code that uses the file will know which format has been read?
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top