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
 

 

cobol program to handle files having different LRECL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Thu Feb 15, 2007 6:04 pm    Post subject: cobol program to handle files having different LRECL
Reply with quote

Hi,

Can any 1 help me regarding this.. i want to write a cobol program to handle files having different LRECL...

Here is a scenario..
thr r 3 input files of LRECL(80,120,400)
If any one is given to input, the program should process thru fine..

Thanks in advance..

Anand B
Back to top
View user's profile Send private message

acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 15, 2007 6:11 pm    Post subject:
Reply with quote

Search for
RECORD CONTAINS 0 CHARACTERS...

P.S.: please don't use SMS style... take your time to write and expose your problem...
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Feb 15, 2007 6:16 pm    Post subject:
Reply with quote

OK, we have the LRECL, what is the RECFM and BLKSIZE of each?
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Thu Feb 15, 2007 7:15 pm    Post subject:
Reply with quote

Why not treat them as one file (concatenate) with the largest lrecl defined in the fd. Make sure the largest bklsize is the first in the concatenation.
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Fri Feb 16, 2007 10:40 am    Post subject:
Reply with quote

ABaluchamy,

Have u ever heard of muliple record length lay out files, the requirement of your's is pertaining to that, but by this process u can only give input as one file with the maximum record length (400 in your case), u can write the records which has lrecl as 80 an 120 in the same file but in different record structures, but u should be having a common key field which is common for all the three files, say for example

Code:
01   1-rec.
       02    key-1 pic x(10).
       02    rec1   pic x(70).
* For lrecl 80
 01   2-rec.
       02    key-2 pic x(10).
       02    rec2   pic x(110).
* For lrecl 120
 01   1-rec.
       02    key-3 pic x(10).
       02    rec1   pic x(100).
       02    rec3   pic x(100).
       02    rec4   pic x(100).
       02    rec4   pic x(90).
* for lrecl 400


All these three record structures shloul pertain to the same file , but can identified individually by the unique record name and accesed, for better understanding pleae refer to file handling concepts for VB files in any COBOL manual.


Cheer's,

Thamilzan.
Back to top
View user's profile Send private message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Fri Feb 16, 2007 5:33 pm    Post subject: Re: cobol program to handle files having different LRECL
Reply with quote

If you test the 'file status' field you can control if the program should abend. I have many programs that read different LRECL files from one DD by doing an open and then testing for a file status of 39. if I get a 39, I close that FD and open it under another FD in the program and so on.(I know that I could possibly read up to X different LRECL files fo I code an FD for each.) used to be a time when you could do a nagative subscribt on the record (start of record minus 4) and get the record length in COBOL.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 6:24 pm    Post subject:
Reply with quote

ABaluchamy wrote:
used to be a time when you could do a nagative subscribt on the record (start of record minus 4) and get the record length in COBOL.
Try a "set address" and decrement the pointer.
William Thompson wrote:
OK, we have the LRECL, what is the RECFM and BLKSIZE of each?
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Fri Feb 16, 2007 8:41 pm    Post subject:
Reply with quote

BaluChamy,
Kindly create the file in the JCL with a lrecl of 404 if ya having 400 bytes of data, I guess the abend would have been S0C4, try these parameters,

dcb=(lrecl=404,blksize=4040,recfm=vb,dsorg=ps)

FS 39 would be for the mismatch lrecl b/w the logical file and the physical file, and that x-tra 4 bytes allocation is for the system to store the length of each and every record.

Thamilzan.
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: Sat Feb 17, 2007 1:42 am    Post subject:
Reply with quote

Hello,

If the files already exist and are of fixed length you cannot just specify VB and hope it will work when you try to read them.

Please look at your 3 files and post the actual dcb attributes for each.

How large are these files? If they are not very large, i can offer a workaround.

When you are reading the data, how do you know if the data is from an 80, 120, or 400 byte record. Given that they are of different lengths, the code will have to know which is being processed.

All of the conversation about "file status" will not help you process the file(s) - it may help you know if you had an error.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts WER247A incompatible lrecl Danielle.Filteau SYNCSORT 8 Tue May 02, 2017 4:04 am


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