That does, indeed, work. And it's also as fugly as h*ck. :-) Thanks Steve.
Frank ----- Original Message ----- > From: Frank Swarbrick <[email protected]> > To: [email protected] > Cc: > Sent: Wednesday, April 11, 2012 12:55 PM > Subject: Re: PL/I with variable PLISTs > > Sorry, Victor's was so short and sweet I used it and assumed it was the same > as yours. I'll look more carefully at yours later. > Thanks! > Frank > > > > ----- Original Message ----- >> From: Steve Comstock <[email protected]> >> To: [email protected] >> Cc: >> Sent: Wednesday, April 11, 2012 12:09 PM >> Subject: Re: PL/I with variable PLISTs >> >> On 4/11/2012 11:38 AM, Frank Swarbrick wrote: >>> Hmmm.... Have you (or anyone) actually verified that this works? I > just >> wrote the following programs: >>> >>> identification division. >>> program-id. callopt. >>> data division. >>> working-storage section. >>> 77 one pic x(4) value z'one'. >>> call 'callee' using one >>> goback. >>> end program callopt. >>> >>> id division. >>> program-id. 'callee'. >>> data division. >>> local-storage section. >>> 77 addr pointer. >>> 77 addr-val redefines addr pic s9(9) comp-5. >>> >>> linkage section. >>> 01 string-1 pic x(101). >>> 01 string-2 pic x(101). >>> >>> 01 result pic s9(8) comp-5. >>> >>> >>> procedure division using string-1 string-2 >>> returning result. >>> call 'print-string' using string-1 >>> set addr to address of string-1 >>> if addr-val not less than zero >>> call 'print-string' using string-2. >>> move zero to result >>> goback. >>> >>> When I run it, according to COBOL ADDR is set to x0F0960B8. I am > guessing >>> thatthe high-order bit is in fact set, but that COBOL does not reveal > that >>> implementation detail to the COBOL application. >>> >>> Either that or I am doing something wrong. >>> >>> Frank >> >> I think Victor's example is wrong. You should follow the >> instructions I gave you. OK, here's a short example of a >> subroutine being passed a variable number of parameters: >> >> process test(sym,none) numproc(pfd) offset opt >> process flag(w,w) map xref(short) >> Identification division. >> program-id. cobsUB3. >> * Copyright (C) 1999 by Steven H. Comstock >> >> environment division. >> data division. >> working-storage section. >> >> 01 text-1. >> 05 pic s9(4) binary value 07. >> 05 pic x(07) >> value ' SUBCOB'. >> >> 01 text-2. >> 05 pic s9(4) binary value 09. >> 05 pic x(09) >> value ' Parm1 '. >> 01 dest pic s9(9) binary value 2. >> 01 fc pic x(12) value low-values. >> >> linkage section. >> 01 parm-1-chk pic s9(9) binary. >> 01 parm-2-ptr pointer. >> 01 parm-2-chk redefines parm-2-ptr. >> 02 parm-2-val pic s9(9) binary. >> 01 parm-3-ptr pointer. >> 01 parm-3-chk redefines parm-3-ptr. >> 02 parm-3-val pic s9(9) binary. >> 01 parm-4-ptr pointer. >> 01 parm-4-chk redefines parm-4-ptr. >> 02 parm-4-val pic s9(9) binary. >> 01 parm-1-value pic s9(9) binary. >> 01 parm-2-value pic s9(9) binary. >> 01 parm-3-value pic s9(9) binary. >> 01 parm-4-value pic s9(9) binary. >> / >> procedure division using by value >> parm-1-chk, >> parm-2-ptr, >> parm-3-ptr, >> parm-4-ptr. >> thecode. >> display '..In COBSUB3' >> display '..parm-1-chk = ' parm-1-chk >> >> set address of parm-2-value to parm-2-ptr >> display '..parm-2-value = ' parm-2-value >> if parm-2-val < 0 >> display 'End of list' >> go to end-of-list >> else >> display 'Not end of list' >> end-if >> >> set address of parm-3-value to parm-3-ptr >> display '..parm-3-value = ' parm-3-value >> if parm-3-val < 0 >> display 'End of list' >> go to end-of-list >> else >> display 'Not end of list' >> end-if >> >> set address of parm-4-value to parm-4-ptr >> display '..parm-4-value = ' parm-4-value >> if parm-4-val < 0 >> display 'End of list' >> go to end-of-list >> else >> display 'Not end of list' >> end-if. >> >> end-of-list. >> display '..Leaving COBSUB3' >> goback. >> >> >> >> Play around with it. >> >> >> >>> >>> >>> >>> ----- Original Message ----- >>>> From: Victor Gil<[email protected]> >>>> To: [email protected] >>>> Cc: >>>> Sent: Wednesday, April 11, 2012 9:36 AM >>>> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM) >>>> >>>> LINKAGE SECTION. >>>> >>>> 01 A-POINTER USAGE POINTER. >>>> 01 BIN-WORD REDEFINES A-POINTER COMP S9(8). >>>> >>>> ... >>>> CALL 'THEFUNCTION' USING MAGIC, INPUT-BUFFER, > INPUT-LENGTH, >> OMITTED, >>>> OMITTED RETURNING RC. >>>> >>>> SET A-POINTER TO ADDRESS OF INPUT-LENGTH >>>> IF BIN-WORD< 0 THEN<the high-bit is ON> >>>> >>>> >> > ================================================================================================ >>>> Funny thing with Enterprise COBOL... It "properly" sets > the >>>> high-order bit on the last parm, but supplies no way to > interrogate >> it! So if >>>> "THEFUNCTION" was written in COBOL then you have to > invoke it >> thusly: >>>> >>>> CALL 'THEFUNCTION' USING MAGIC, INPUT-BUFFER, > INPUT-LENGTH, >> OMITTED, >>>> OMITTED >>>> RETURNING RC. >>>> >>>> (The OMITTED keyword simply passes an address of NULL.) >>>> >>>> Oy! >>>> >>>> Frank >>>> >>>> > ---------------------------------------------------------------------- >>>> For IBM-MAIN subscribe / signoff / archive access instructions, >>>> send email to [email protected] with the message: INFO IBM-MAIN >>>> >>> >>> ---------------------------------------------------------------------- >>> For IBM-MAIN subscribe / signoff / archive access instructions, >>> send email to [email protected] with the message: INFO IBM-MAIN >> >> >> -- >> Kind regards, >> >> -Steve Comstock >> The Trainer's Friend, Inc. >> >> 303-355-2752 >> http://www.trainersfriend.com >> >> * To get a good Return on your Investment, first make an investment! >> + Training your people is an excellent investment >> >> * Try our tool for calculating your Return On Investment >> for training dollars at >> http://www.trainersfriend.com/ROI/roi.html >> >> ---------------------------------------------------------------------- >> For IBM-MAIN subscribe / signoff / archive access instructions, >> send email to [email protected] with the message: INFO IBM-MAIN >> > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN

