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
 

 

Write a Variable Block File

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Write a Variable Block File
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: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 12, 2009 4:11 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 12, 2009 4:23 pm    Post subject:
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 12, 2009 4:40 pm    Post subject:
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: 7908
Location: Bellevue, IA

PostPosted: Thu Feb 12, 2009 5:11 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 12, 2009 5:50 pm    Post subject:
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    Post subject: Reply to: Write a Variable Block File
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: 7908
Location: Bellevue, IA

PostPosted: Thu Feb 12, 2009 6:00 pm    Post subject:
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

Site Director


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

PostPosted: Thu Feb 12, 2009 9:44 pm    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 12, 2009 9:52 pm    Post subject: Reply to: Write a Variable Block File
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 -

http://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: 2150
Location: At my coffee table

PostPosted: Thu Feb 12, 2009 9:56 pm    Post subject:
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

Site Director


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

PostPosted: Fri Feb 13, 2009 12:36 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM 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 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
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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