Could you point the programmer to the COBOL Reference and the following section?

Alignment rules
.....
Alphanumeric, alphanumeric-edited, alphabetic, DBCS
For these receiving items, the following rules apply:
        1. The data is aligned at the leftmost character position, and (if 
necessary)
        truncated or padded with spaces at the right.

And since the caller's data/storage address is passed to the subroutine the 
caller's data area gets padded.

-----Original Message-----
From: John McKown [mailto:john.archie.mck...@gmail.com] 
Sent: Wednesday, September 11, 2013 1:21 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL "problem" (not really), but sort of.

I can try that. The programmer says that he intents to define the passed in 
area in the calling program at the front of his WORKING-STORAGE so that the 
area is larger. I.e. it is _planning_ on a buffer overflow and _hoping_ that it 
doesn't affect the calling program. I don't have authority to disallow this. 
And we don't do any kind of peer review because we just don't have the people 
left.


On Wed, Sep 11, 2013 at 12:09 PM, Thomas Berg <thomas.b...@swedbank.se>wrote:

> I would say: the READ .. INTO .. statement doesn't look at the 
> numerical value in the length field, it only looks at the max possible 
> length as defined. And acts accordingly.
>
>
>
> Best Regards
> Thomas Berg
> ___________________________________________________________________
> Thomas Berg   Specialist   zOS\RQM\IT Delivery   SWEDBANK AB (Publ)
>
> > -----Original Message-----
> > From: IBM Mainframe Discussion List 
> > [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of John McKown
> > Sent: Wednesday, September 11, 2013 7:02 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: COBOL "problem" (not really), but sort of.
> >
> > A programmer came by today with a problem. He is sometimes getting a
> > S0C4-4 abend in a COBOL program. This is a subroutine. One of the 
> > parameters passed in is a data area, which can be of various 
> > lengths. It is defined with an OCCURS DEPENDING ON with a data 
> > element within the area. I.e. the first 05 level is PIC S9(5) COMP. 
> > The subroutine does a READ of a data set into this area. This is 
> > where the abend occurs. The reason is because the OCCURS DEPENDING 
> > ON maximum size is significantly larger than what the caller is 
> > passing it. And the READ to the 01 is trying to pad the entire possible 01 
> > level with blanks.
> >
> > The problem is how do I describe this to a COBOL programmer who just 
> > doesn't "get it". He expects COBOL to _not_ pad the "non existent"
> > occurrences with blanks. And, if fact, to not even reference this 
> > area wherein they would have resided, had they existed. I'm just get 
> > "deer in headlights" looks. I'm not using the correct words, somehow.
> >
> > --
> > As of next week, passwords will be entered in Morse code.
> >
> > Maranatha! <><
> > John McKown
> >
> > --------------------------------------------------------------------
> > -- For IBM-MAIN subscribe / signoff / archive access instructions, 
> > send email to lists...@listserv.ua.edu with the message: INFO 
> > IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send 
> email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>



--
As of next week, passwords will be entered in Morse code.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to