Variable length block file



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Variable length block file

Postby indianrajput » Fri Nov 19, 2021 1:14 am

Hi,
I have two sequential input files , one is variable length block (In-VB-File) and another is fixed block (In-FB-File). Logical record length of In-VB-File is 6104 (declared as 6100 bytes) and number of records are more than 2 millions and In-FB-File size is 93 bytes. My requirement is to read each record of the file In-FB-File and search in In-FB-File, if found , get the details of that record from In-FB-File and also take corresponding details from In-VB-File and write those into a Variable length block output file (Out-VB-File) of Logical record length 6174 (declared as 6171) bytes.
While executing the job I am getting file status 34 (boundaries violation ) while writing the output file

May I request someone to help me out with an example pls?

Regards
Singh
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length block file

Postby sergeyken » Fri Nov 19, 2021 2:02 am

0. There are millions of examples for this task available anywhere in this world. No need to ask people to re-invent what has been done ages ago.
1. Present your code (or critical part(s) of it)
2. Present your data (or critical part(s) of it)
3. Present your results, including error message(s)
4. Don't forget to use this:
CODE TAGS for your samples
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Variable length block file

Postby Robert Sample » Fri Nov 19, 2021 7:36 am

write those into a Variable length block output file (Out-VB-File) of Logical record length 6174 (declared as 6171) bytes.
6174 minus 6171 is 3 bytes -- the record descriptor word (RDW) for variable length data sets is ALWAYS 4 bytes.

You did not say how many records are in the VB and the FB data sets -- that information is critical for proper system design. You also did not specify that the data sets were sorted (much less sorted with the same keys) which is important to know. In general, it is not a good idea to search a data set millions of times the way your problem description mentions. Make the FB a keyed VSAM data set so you don't search it at all and the processing time will be much improved.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Variable length block file

Postby indianrajput » Sun Nov 21, 2021 1:02 pm

Hi Robert,
I have two sequential input files , one is variable length block (In-VB-File) and another is fixed block (In-FB-File). Logical record length of In-VB-File is 6104 (declared as 6100 bytes) and number of records are more than 2 millions and In-FB-File size is 93 bytes. My requirement is to read each record of the file
In-VB-File and search in In-FB-File, if found , get the details of matched record from In-FB-File and also corresponding details from In-VB-File and write those into a Variable length block output file (Out-VB-File) of Logical record length 6175 (declared as 6171) bytes.
While executing the job I am getting file status 34 (boundaries violation ) while writing the output file

Thanks a lot for the quick reply. sorry , its typo mistake, the logical record length of out variable length file 6175 instead of 6174. Unable create a VSAM file since there is no key in the file.
THANKS
Singh
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length block file

Postby indianrajput » Sun Nov 21, 2021 4:27 pm

sergeyken wrote:0. There are millions of examples for this task available anywhere in this world. No need to ask people to re-invent what has been done ages ago.
1. Present your code (or critical part(s) of it)
2. Present your data (or critical part(s) of it)
3. Present your results, including error message(s)
4. Don't forget to use this:
CODE TAGS for your samples


Hi Sergeyken,
Thanks for your answer . I am new to the forum so can you please guide me where is the example related to VB file to VB file movement ....
If you want I can share my code too
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length block file

Postby indianrajput » Sun Nov 21, 2021 4:31 pm

Robert Sample wrote:
write those into a Variable length block output file (Out-VB-File) of Logical record length 6174 (declared as 6171) bytes.
6174 minus 6171 is 3 bytes -- the record descriptor word (RDW) for variable length data sets is ALWAYS 4 bytes.

You did not say how many records are in the VB and the FB data sets -- that information is critical for proper system design. You also did not specify that the data sets were sorted (much less sorted with the same keys) which is important to know. In general, it is not a good idea to search a data set millions of times the way your problem description mentions. Make the FB a keyed VSAM data set so you don't search it at all and the processing time will be much improved.


Hi Robert.
I am very sorry for my typo mistake ...the LRECL of my VB file is 6175 instead o 6174. here is the corrected statement :

I have two sequential input files , one is variable length block (In-VB-File) and another is fixed block (In-FB-File). Logical record length of In-VB-File is 6104 (declared as 6100 bytes) and number of records are more than 2 millions and In-FB-File size is 93 bytes. My requirement is to read each record of the file
In-VB-File and search in In-FB-File, if found , get the details of matched record from In-FB-File and also corresponding details from In-VB-File and write those into a Variable length block output file (Out-VB-File) of Logical record length 6175 (declared as 6171) bytes.
While executing the job I am getting file status 34 (boundaries violation ) while writing the output file

THANKS
Singh
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length block file

Postby indianrajput » Sun Nov 21, 2021 5:06 pm

indianrajput wrote:
Robert Sample wrote:
write those into a Variable length block output file (Out-VB-File) of Logical record length 6174 (declared as 6171) bytes.
6174 minus 6171 is 3 bytes -- the record descriptor word (RDW) for variable length data sets is ALWAYS 4 bytes.

You did not say how many records are in the VB and the FB data sets -- that information is critical for proper system design. You also did not specify that the data sets were sorted (much less sorted with the same keys) which is important to know. In general, it is not a good idea to search a data set millions of times the way your problem description mentions. Make the FB a keyed VSAM data set so you don't search it at all and the processing time will be much improved.


Hi Robert.
I am very sorry for my typo mistake ...the LRECL of my VB file is 6175 instead o 6174. here is the corrected statement :

I have two sequential input files , one is variable length block (In-VB-File) and another is fixed block (In-FB-File). Logical record length of In-VB-File is 6104 (declared as 6100 bytes) and number of records are more than 2 millions and In-FB-File size is 93 bytes. My requirement is to read each record of the file
In-VB-File and search in In-FB-File, if found , get the details of matched record from In-FB-File and also corresponding details from In-VB-File and write those into a Variable length block output file (Out-VB-File) of Logical record length 6175 (declared as 6171) bytes.
While executing the job I am getting file status 34 (boundaries violation ) while writing the output file


Code is as below :
FD IN-VB-FILE
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
LABEL RECORDS STANDARD
RECORD IS VARYING IN SIZE
FROM 79 TO 6100 DEPENDING
ON WS-INVB-REC-LENGTH.

01 FS-INVB-REC PIC X(6100).

FD OUT-VB-FILE
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
LABEL RECORDS STANDARD
RECORD IS VARYING IN SIZE
FROM 150 TO 6171 DEPENDING
ON WS-OVB-REC-LENGTH.
01 FS-OVB-REC PIC X(6171).

WORKING-STORAGE SECTION.
77 WS-INVB-REC-LENGTH PIC 9(05) VALUE ZEROS.
77 WS-OVB-REC-LENGTH PIC 9(05) VALUE ZEROS.


PROCEDURE DIVISION.
.......
......
....
...

SUBTRACT 78 FROM WS-INVB-REC-LENGTH
GIVING WS-PREM-LEN

COMPUTE WS-OVB-REC-LENGTH = 150 + WS-PREM-LEN

MOVE FS-INVB-REC(1:4) TO FS-OVB-REC(1:4)
MOVE SPACE TO FS-OVB-REC(5:1)
MOVE FS-INVB-REC(5:3) TO FS-OVB-REC(6:3)
MOVE SPACES TO FS-OVB-REC(9:4)
MOVE FS-INVB-REC(22:28) TO FS-OVB-REC(13:28)
MOVE FS-INVB-REC(51:28) TO FS-OVB-REC(41:28)
MOVE FS-INVB-REC(79:WS-PREM-LEN)
TO FS-OVB-REC(150:WS-PREM-LEN)
MOVE FS-INVB-REC(1:WS-INVB-REC-LENGTH)
TO FS-OVB-REC(1:WS-OVB-REC-LENGTH

WRITE FS-OVB-REC
END-WRITE.


IF WS-OVBFILE-STATUS NOT = 0
DISPLAY 'WS-OVBFILE-STATUS : 'WS-OVBFILE-STATUS
END-IF.

IF WS-EOF-INFBFILE NOT = 'Y'
CLOSE IN-FB-FILE
END-IF
READ IN-VB-FILE
AT END MOVE 'Y' TO WS-EOF-INVBFILE
END-READ


THANKS
Singh
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length block file

Postby sergeyken » Mon Nov 22, 2021 12:24 am

indianrajput wrote:
sergeyken wrote:0. There are millions of examples for this task available anywhere in this world. No need to ask people to re-invent what has been done ages ago.
1. Present your code (or critical part(s) of it)
2. Present your data (or critical part(s) of it)
3. Present your results, including error message(s)
4. Don't forget to use this:
CODE TAGS for your samples


Hi Sergeyken,
Thanks for your answer . I am new to the forum so can you please guide me where is the example related to VB file to VB file movement ....
If you want I can share my code too


1. One of thousands of easily available examples with comments:
http://coboltuts.blogspot.com/p/file-ha ... iable.html

. . . . . . . . . . .

4. Don't forget to use this:
CODE TAGS for your samples
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Variable length block file

Postby Robert Sample » Mon Nov 22, 2021 1:50 am

I'm fairly confused at this point. Your problem statements reference an input VB file and an input FB file, yet none of the code you have shown references an FB input file. What does the DD statement for your output VB file look like? File status 34, in my experience, happens most frequently when the DD statement parameters do not match the COBOL program parameters. It is also possible that your issue is that you are writing fixed-length records (FS-OVB-REC) into your VB data set. What does the compile XREF have for the attributes of your output VB file?

The art (and it is definitely an art) of debugging is difficult for many programmers to grasp as they are trying to find errors in their code. Questions you should ask yourself include (but certainly are not limited to):
- When does the file status 34 occur -- on first write? after first write?
- If after first write, what is different about that record where the first write succeeded?
- How many bytes is the program trying to write for the record having the issue?
- What are the values for WS-INVB-REC-LENGTH and WS-OVB-REC-LENGTH for that record?
- What does FS-OVB-REC look like for that record?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Variable length block file

Postby indianrajput » Tue Nov 23, 2021 7:32 am

Robert Sample wrote:I'm fairly confused at this point. Your problem statements reference an input VB file and an input FB file, yet none of the code you have shown references an FB input file. What does the DD statement for your output VB file look like? File status 34, in my experience, happens most frequently when the DD statement parameters do not match the COBOL program parameters. It is also possible that your issue is that you are writing fixed-length records (FS-OVB-REC) into your VB data set. What does the compile XREF have for the attributes of your output VB file?

The art (and it is definitely an art) of debugging is difficult for many programmers to grasp as they are trying to find errors in their code. Questions you should ask yourself include (but certainly are not limited to):
- When does the file status 34 occur -- on first write? after first write?
- If after first write, what is different about that record where the first write succeeded?
- How many bytes is the program trying to write for the record having the issue?
- What are the values for WS-INVB-REC-LENGTH and WS-OVB-REC-LENGTH for that record?
- What does FS-OVB-REC look like for that record?



Hi Robert,
Thanks a lot for the reply. Yes I have not shared the code of FB dataset.
Reply of the question asked by you :
- When does the file status 34 occur -- on first write? after first write? ---->at record number 1446521 (out of more than 2 million records)
- If after first write, what is different about that record where the first write succeeded? -----> I don't see any difference other than record length and off course the value of in it
- How many bytes is the program trying to write for the record having the issue? -----> 285
- What are the values for WS-INVB-REC-LENGTH and WS-OVB-REC-LENGTH for that record? ----> WS-INVB-REC-LENGTH = 214 and WS-OVB-REC-LENGTH = 285
- What does FS-OVB-REC look like for that record?[/quote] - did not understand this question

JCL : -
//BKSJOB JOB (' SALESFORCE '),NOTIFY=BKS,
// CLASS=B,REGION=4M
//*
//*--------------------------------------------------------------
//* CREATING A SALESFORCE FILE
//*--------------------------------------------------------------
//*
//STEP01 EXEC PGM=EXP04
//STEPLIB DD DSN=LMPAF6.TEST.LOAD,DISP=SHR
//SYSDBOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//INVBSFIL DD DSN=LMPAF5.INVBFILE.SORT,DISP=SHR
//*INFBOFIL DD DSN=LMPAF5.INFBFILE.SORT,DISP=SHR
//OVBFIL DD DSN=LMPAF6.SFADD.FILE2,
// UNIT=SYSDA,VOL=SER=LMSUSA,
// DISP=(NEW,CATLG,CATLG),SPACE=(CYL,(50,50),RLSE),
// DCB=(DSORG=PS,RECFM=VB,LRECL=6175,BLKSIZE=0)
indianrajput
 
Posts: 9
Joined: Fri Nov 19, 2021 12:52 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post