IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

mismatch of LRECL in cobol program and jcl.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nitya
Warnings : 2

New User


Joined: 09 Dec 2005
Posts: 17
Location: Tirupathi

PostPosted: Wed Feb 07, 2007 6:02 pm
Reply with quote

You are creating a output file throuch a COBOL programme. The Record length mentioned in the DCB parameter of
the JCL is (LCREL=100) and the record layout mentioned in the FILE SECTION of the DATA DIVISION is 01 WS-FILE-REC PIC X(120).

a) The compilation of the programme will give an error
b) Error will be encountered during the run time.
c) No errors will occur but a file of record length 100 bytes will be created
d) A file of record length 120 bytes will be created

can anyone explain wt will happen??

Regards
Nitya.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1049
Location: Richmond, Virginia

PostPosted: Wed Feb 07, 2007 6:29 pm
Reply with quote

The compiler knows nothing about the actual datasets that will be referenced by the running program. That connection is made via the run JCL's ddnames, so the compiler cannot tell you.

All systems I've worked on issue a run-time error when the OPEN is executed.
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: Wed Feb 07, 2007 8:49 pm
Reply with quote

Yup,

I'd bet on the 013-20 abend.

Maybe we can get a moderator to move this to the "interview questions" forum . . . .
Back to top
View user's profile Send private message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Thu Feb 08, 2007 2:58 am
Reply with quote

definitely it will throw an ABEND.
Back to top
View user's profile Send private message
udaybarath

New User


Joined: 10 May 2005
Posts: 7

PostPosted: Fri Feb 09, 2007 10:29 am
Reply with quote

The compliation of the program doesnot relate to any JCl. so ofcourse it wont give any compliation error.
But it will give run time error with an abend of file status 39.

Correct me if i am wrong?

Thanks and regards,
Uday.
Back to top
View user's profile Send private message
bajibabu

New User


Joined: 01 Aug 2005
Posts: 5
Location: hyderabad

PostPosted: Fri Feb 09, 2007 11:11 am
Reply with quote

Hi,
Ans for this Q is b) Error will be encountered during the run time.

Thanks
Bajibabu
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 09, 2007 5:39 pm
Reply with quote

Hi All,
Everybody has given the correct ans. , Yes the system would throw an abend , U would get a SOC4, reason being Addressablity mismatch, and the pgm would abend when it encounters a open st. , the file status would be 48


Cheer's,

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

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Fri Feb 09, 2007 7:35 pm
Reply with quote

Your JOB definetly ABEND if you are compiling in Enterprise COBOL. That could be Record length mismatch.

I am not sure about other old COBOL versions.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Fri Feb 09, 2007 7:41 pm
Reply with quote

That will give a record length mis match error at run time
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Feb 10, 2007 4:45 am
Reply with quote

BTW, a pgm doesn't ABEND when you use file status for the file. YOU have to abend it if you desire it.

In this case you should get an OPEN error (abend or RC depending on whether you specify file stat or not).
Back to top
View user's profile Send private message
Pete Eagleton

New User


Joined: 14 Feb 2007
Posts: 11
Location: Chicago

PostPosted: Fri Feb 16, 2007 12:07 am
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
trgk03

New User


Joined: 20 Jan 2006
Posts: 12
Location: kochi

PostPosted: Fri Feb 16, 2007 10:29 am
Reply with quote

It will give a s806 abend saying A file attribute mismatch was detected.
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:45 am
Reply with quote

trgk03,
Do u Know watz a S806 Abend is ????????????
Please check your JCL manuals.

Cheer's,

Thamilzan.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 3:22 pm
Reply with quote

you get file status 39
check it
from-sachin borase
pune
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 23, 2007 8:39 pm
Reply with quote

Hello,

Yes, if you check for it in the code you can work with the "status 39" causing a "user abend" or setting "return-code".

If you do not check the status in the program, you will get an "open error" which is an s013, not an s806.
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: Sat Feb 24, 2007 2:59 pm
Reply with quote

Dick,
S013 would be member not found as per my knowledge, I had a similar situation at my work place where the lrecl of the physical file and logical file were not matching for which i had a S0c4 ,as i was trying to reach an address that was not available, in the physical file, I checked the SYSOUT in SPOOL it gave me a 39 FS , so it would be more prompt to say that a S0c4 would come insd of a S013, please correct me if i am wrong.

Thamilzan.
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: Sun Feb 25, 2007 12:48 am
Reply with quote

Hi Thamilzan,

Quote:
please correct me if i am wrong


I believe this is the case. Please look in the system completion codes documentation for the entire definition of an 0c4 and an 013. Some of it is pasted here:

Quote:
013

Explanation: The error occurred during processing of an OPEN macro
instruction. This system completion code is accompanied by message
IEC141I. Refer to the explanation of message IEC141I for complete
information about the task that was ended and for an explanation of
the return code (rc in the message text) in register 15.

and
Quote:
0C4 One of the following exceptions occurred:

4 Protection exception. The key of the storage area
that the running program tries to access is
different from that of the running program. The key
of the running program can be obtained from the PSW
key field. The key of the storage can be obtained
using the IPCS LIST subcommand. The programmer
should determine whether the program is running
with the correct key or whether the storage address
is set up correctly.

10 Segment-translation exception. This error is
| caused by one of the following:

| ? A program that was running disabled attempted
| to reference storage while the page table for
| that storage was paged out. To correct the
| error, page-fix the storage before a program
| running disabled attempts to reference it.

| ? A program attempted to reference storage that
| had not been obtained. To correct the error,
| allocate the storage before attempting to
| reference it.

| ? A program running in a subspace attempted to
| reference storage that was not accessible to
| the subspace at the time of error. To correct
| the error, ensure that the program running in a
| subspace references only the storage assigned
| to that subspace, or storage that can be
| referenced by all subspaces.

11 Page-translation exception. This error is caused
| by one of the following:

| ? A program that was running disabled attempted
| to reference storage while that storage was
| paged out. To correct the error, page-fix the
| storage before a program running disabled
| attempts to reference it.

| ? A program attempted to reference storage that
| had not been obtained. To correct the error,
| allocate the storage before attempting to
| reference it.

| ? A program running in a subspace attempted to
| reference storage that was not accessible to
| the subspace at the time of error. To correct
| the error, ensure that the program running in a
| subspace references only the storage assigned
| to that subspace, or storage that can be
| referenced by all subspaces.




Please note that none of the 0c4 conditions are involved with an OPEN. The 2 most common causes of 0c4 conditions that i encounter are:
1) when one piece of code is trying to communicate with another piece of code and the "handshake" is inconsistent
and
2) when an internal sort is running and the program is terminated while sort is in process. It seems to "lose" itself and does NOT end gracefully.

If you look at the IEC141I message, you will see that
Quote:
IEC141I 013-rc,mod,jjj,sss, ddn[-#] [,dev,ser, dsn]

Explanation: The error occurred during processing of an OPEN macro. This message is accompanied by system completion code 013 with the return code.

18
An OPEN macro instruction was issued for a partitioned data set. The DSNAME parameter specified a member that could not be found.

20
An OPEN macro instruction was issued for a sequential data set using queued access. Either BLKSIZE is not a multiple of LRECL, LRECL=0 when RECFM=FB or FBS, or BLKSIZE is not four bytes greater than LRECL when RECFM=V.


I've included the 013-18 and 013-20 info as they are the 2 of most common open abends encountered by programmers; the -18 caused by a member name typo or the menber not yet created and the -20 because of mis-matched dcb info.

The info pasted above is from the manuals available in the "Manuals" link on this site.

Please let me know if you'd like any other info.
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: Mon Feb 26, 2007 1:08 pm
Reply with quote

Dick,
Thanks a lot for this explanation, but still please note this point

Quote:
| ? A program attempted to reference storage that
| had not been obtained. To correct the error,
| allocate the storage before attempting to
| reference it.


This is wat makes me to feel that i can be a S0c4, say we have a lrecl=100 for the logical file inside cbl, and in the jcl we had defined the file with lrecl=80, when execution as u had mentioned a HANDSHAKE happens with the logical file and physical file when the mismatch is detected it throws a S0c4, further to this if u r trying to write 100 bytes of data in to a 80 byte file the above quote becomes the absolute truth , trying to reference a memory location that is not available for the system to process (trying to push the extra 20 bytes after writing 80 bytes). But its good to know that it can also be a S013-20 abend.


Thamilzan.
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: Mon Feb 26, 2007 9:02 pm
Reply with quote

Hello,

You do not yet understand - it is not that an open error can also be an 013 - a dcb mismatch will cause an 013 about 99.999% of the time.

I have not yet seen an 0c4 because of inconsistent dcbs alone. If there are other problems with the program, say that some storage has already been walked on, then an open is issued using storage that has already been corrputed by "other problem(s)", an oc4 could occur - but that is not an "open error". That is a problem with other than open code and changing dcb info will not resolve it.

Do you speak assembler? The reference you quoted is for assembler programming and you don't have the opportunity to create that problem when you write COBOL code.

If you look thru the dump you may see that there was one or more errors before the 0c4. If the program is in the middle of an internal sort, and the sort is ungracefully terminated, you may see an 0c4.

But as a rule 013s are open errors (per IBM) and 0c4s are not.

If you'd like any other info, please let us know.
Back to top
View user's profile Send private message
j_sram

New User


Joined: 03 Jul 2006
Posts: 6

PostPosted: Wed Feb 28, 2007 5:30 pm
Reply with quote

program will abend!!!!!
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Compile Sp Cobol base COBOL Programming 1
Search our Forums:

Back to Top