Re: Cobol

Liste des GroupesRevenir à co vms 
Sujet : Re: Cobol
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 05. Feb 2025, 03:03:10
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <67a2c6de$0$713$14726298@news.sunsite.dk>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Mozilla Thunderbird
On 2/2/2025 9:55 PM, Arne Vajhøj wrote:
On 2/2/2025 8:37 PM, Arne Vajhøj wrote:
On 2/2/2025 8:30 PM, Arne Vajhøj wrote:
 > On 1/14/2025 11:06 AM, Arne Vajhøj wrote:
 >> On 1/13/2025 9:11 PM, John Reagan wrote:
 >>> COBOL paragraphs behave like C.  First routine/PARAGRAPH gets a WEAK
 >>> transfer address.  Linker finds the first one.
 >>
 >> I have many prejudices about COBOL developers.
 >>
 >> One of them is that they don't create shareable images.
 >>
 >> :-)
 >
 > But let us say that someone wanted to create a shareable
 > image in Cobol.
 >
 > A typical Cobol program just have all the paragraphs that
 > get performed and they share state. Simple.
 >
 > To make them entry points with arguments in a shareable image,
 > then I assume one need to make them programs with linkage section
 > and procedure division using.
 >
 > Normal variables are just passed as arguments. Seems entirely
 > unproblematic to me.
 >
 > But how does one share open files between modules?
 >
 > Fortran and Basic numeric identifiers work across modules.
 > Pascal can share via inherit. C can use global variables
 > or just pass as argument.
 >
 > But how does one do that in Cobol?
 >
 > Can one mark an fd as global or can one pass a fd as argument?
>
Did some reading.
>
IS GLOBAL in one module and IS EXTERNAL in the other modules?
 And what to put in SELECT if FD is EXTERNAL?
Just EXTERNAL everywhere and no GLOBAL and nothing on SELECT
seems to do the trick.
identification division.
program-id.m2.
*
environment division.
input-output section.
file-control.
     select in-file assign to "a.dat" organization is sequential.
     select out-file assign to "c.dat" organization is sequential.
*
data division.
file section.
fd in-file external record is varying in size depending on line-len.
01 in-record.
     03 in-line pic x(100).
fd out-file external record is varying in size from 0 to 100 depending on line-len.
01 out-record.
     03 out-line pic x(100).
working-storage section.
01 line-len pic 9(8) comp external.
*
procedure division.
main-paragraph.
     open input in-file
     open output out-file
     call "docopy" end-call
     close in-file
     close out-file
     stop run.
end program m2.
*
identification division.
program-id. docopy.
*
environment division.
input-output section.
file-control.
     select in-file assign to "a.dat" organization is sequential.
     select out-file assign to "c.dat" organization is sequential.
*
data division.
file section.
fd in-file external record is varying in size depending on line-len.
01 in-record.
     03 in-line pic x(100).
fd out-file external record is varying in size from 0 to 100 depending on line-len.
01 out-record.
     03 out-line pic x(100).
working-storage section.
01 line-len pic 9(8) comp external.
01 eof-flag pic x.
*
procedure division.
main-paragraph.
     move "N" to eof-flag
     perform until eof-flag = "Y"
         read in-file
             at end
                 move "Y" to eof-flag
             not at end
                 move in-line(1:line-len) to out-line
                 write out-record
         end-read
     end-perform.
end program docopy.
Arne

Date Sujet#  Auteur
8 Jan 25 * Fun trick39Arne Vajhøj
8 Jan 25 +- Re: Fun trick1Lawrence D'Oliveiro
8 Jan 25 +* Re: Fun trick11John Reagan
8 Jan 25 i`* Re: Fun trick10Arne Vajhøj
8 Jan 25 i `* Re: Fun trick9John Reagan
8 Jan 25 i  +* Re: Fun trick2Arne Vajhøj
8 Jan 25 i  i`- Re: Fun trick1Arne Vajhøj
8 Jan 25 i  `* Re: Fun trick6Arne Vajhøj
14 Jan 25 i   `* Re: Fun trick5John Reagan
14 Jan 25 i    `* Re: Fun trick4Lawrence D'Oliveiro
14 Jan 25 i     `* Re: Fun trick3Arne Vajhøj
14 Jan 25 i      +- Re: Fun trick1Arne Vajhøj
15 Jan 25 i      `- Re: Fun trick1John Reagan
8 Jan 25 `* Re: Fun trick26hb0815
8 Jan 25  `* Re: Fun trick25Arne Vajhøj
8 Jan 25   `* Re: Fun trick24hb0815
9 Jan 25    `* Re: Fun trick23Arne Vajhøj
9 Jan 25     `* Re: Fun trick22hb0815
13 Jan 25      +* Re: Fun trick11Arne Vajhøj
17 Jan 25      i`* GNU diff command, was: Re: Fun trick10Simon Clubley
17 Jan 25      i `* Re: GNU diff command, was: Re: Fun trick9Craig A. Berry
17 Jan 25      i  `* Re: GNU diff command, was: Re: Fun trick8Craig A. Berry
19 Jan 25      i   `* Re: GNU diff command, was: Re: Fun trick7hb0815
21 Jan 25      i    `* Re: GNU diff command, was: Re: Fun trick6Craig A. Berry
22 Jan 25      i     `* Re: GNU diff command, was: Re: Fun trick5hb0815
22 Jan 25      i      `* Re: GNU diff command, was: Re: Fun trick4Lawrence D'Oliveiro
23 Jan 25      i       `* Re: GNU diff command, was: Re: Fun trick3Robert A. Brooks
24 Jan 25      i        `* Re: GNU diff command, was: Re: Fun trick2Simon Clubley
25 Jan 25      i         `- Re: GNU diff command, was: Re: Fun trick1Dave Froble
13 Jan 25      `* Re: Fun trick10Arne Vajhøj
13 Jan 25       `* Re: Fun trick9Lawrence D'Oliveiro
13 Jan 25        `* Re: Fun trick8Arne Vajhøj
14 Jan 25         +* Re: Fun trick6John Reagan
14 Jan 25         i`* Re: Fun trick5Arne Vajhøj
3 Feb 25         i +- Cobol (was Re: Fun trick)1Arne Vajhøj
3 Feb 25         i `* Re: Fun trick3Arne Vajhøj
3 Feb 25         i  `* Cobol (was: Re: Fun trick)2Arne Vajhøj
5 Feb 25         i   `- Re: Cobol1Arne Vajhøj
14 Jan 25         `- Re: Fun trick1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal