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: 8796
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: 8796
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: 8796
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: 8700
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: 8796
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: 8700
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: 19243
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: 19243
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts how to eliminate null indicator value... DB2 7
No new posts CA7 count with DATE variable CA Products 0
Search our Forums:

Back to Top