View previous topic :: View next topic
|
Author |
Message |
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
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 |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
OK, we have the LRECL, what is the RECFM and BLKSIZE of each? |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
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 |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|