¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: ChapGPT

 

Hi,

This version writes 2 times the last record

¸é±ð²Ô¨¦


Le vendredi 6 janvier 2023, 09:25:25 UTC+1, Don.isenstadt <don.isenstadt@...> a ¨¦crit :


Bob,

I used write a complete cobol program¡­ also you can use regenerate and it might add the working storage. I liked the explanation at the end..

Did it write the program or did it ¡°find¡± it? Could not get it to use goback.

So I asked GPT why it does not use goback..


Using "STOP RUN" terminates the entire program and closes all files. "GOBACK" simply exits the current PERFORM or READ loop and returns control to the beginning of the loop. In this case, using "GOBACK" instead of "STOP RUN" would cause the program to continuously loop through the file, reading and printing each record indefinitely. "STOP RUN" is used to end the program after all records have been read and printed.

That is perhaps why it gets away without the working storage flag?


IDENTIFICATION DIVISION.

PROGRAM-ID. READ-AND-PRINT.


ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

???SELECT INPUT-FILE ASSIGN TO "input.txt"

???ORGANIZATION IS SEQUENTIAL.


DATA DIVISION.

FILE SECTION.

???FD INPUT-FILE.

???01 INPUT-RECORD.

?? ? ??02 INPUT-FIELD PIC X(30).


WORKING-STORAGE SECTION.

???01 EOF-FLAG PIC X VALUE 'N'.


PROCEDURE DIVISION.

???OPEN INPUT INPUT-FILE

???PERFORM UNTIL EOF-FLAG = 'Y'

? ? ??READ INPUT-FILE

?? ? ? ??AT END MOVE 'Y' TO EOF-FLAG

? ? ??END-READ

? ? ??DISPLAY INPUT-FIELD

???END-PERFORM

???CLOSE INPUT-FILE

???STOP RUN.


Explanation:

The IDENTIFICATION DIVISION and PROGRAM-ID paragraphs are used to identify the program.

The ENVIRONMENT DIVISION contains the INPUT-OUTPUT SECTION, where we specify the input file and its organization (in this case, sequential).

The DATA DIVISION contains the FILE SECTION, where we define the input file and its record layout (in this case, a single field of 30 characters).

The WORKING-STORAGE SECTION is used to define any variables or flags that we need to use in our program. In this case, we define a flag?EOF-FLAG?to keep track of whether we have reached the end of the file.

In the PROCEDURE DIVISION, we open the input file, then perform a loop until we reach the end of the file. Inside the loop, we read a record from the file and display it. If the end of the file is reached, we set the?EOF-FLAG?to 'Y' to signal that the loop should terminate. Finally, we close the input file and stop the program.







Air 2

On Jan 6, 2023, at 1:43 AM, Bob Flanders <bob.flanders@...> wrote:


Re: 3390/3990-06 I/O Error reported

 

Joe Monk wrote:

The CCW in question: 18000000 00004100 00000000
Wrong. The CCW in question is F760000C 7E84DF58.

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...


Re: 3390/3990-06 I/O Error reported

 

Peter Morrison wrote:

[...]
The particular code in question is X¡¯18.¡¯
Wrong. The particular code in question is X'F7'. Refer to Jo?o's original post and my reply:

* /g/H390-MVS/message/3187
* /g/H390-MVS/message/3192

The CCW that is failing is F760000C 7E84DF58.

The DATA that the ccw points to is 18000000 00004100 00000000.


[...]
So, this is not a ¡®new¡¯ command code
Whether it is a new or old command code makes no difference. The only thing that matters is that it is an UNDOCUMENTED command code.


that Hercules cannot understand, it is an error!
It is a LIMITATION, not an error (per se).

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...


Re: 3390/3990-06 I/O Error reported

 

The CCW in question:?18000000 00004100 00000000

Thats not a valid format-0 CCW either.

image.png
The address if it were a format-0 CCW is absolute location zero.

Either way its not a valid TIC CCW.

Joe


On Sat, Jan 7, 2023 at 4:29 PM <petmo@...> wrote:

People

?

If you look at the POP, the chapter on ¡®basic I/O ?functions¡¯, there is a chart (in my POP, fig 15-5) that shows the bit assignment for CCW command codes.? The particular code in question is X¡¯18.¡¯ If this is a fmt 0 CCW, that is supposed to be interpreted as a TIC (which is valid) and in the case of a fmt 1 CCW, it is invalid. The message does not indicate the CCW format being used (it should) but, if it is a fmt 1 CCW, the message is correct. IBM (and anybody else) cannot add arbitrary CCW command codes here ¨C the figure indicates where they are allowed. So, this is not a ¡®new¡¯ command code that Hercules cannot understand, it is an error!??

?

Peter Morrison


Re: 3390/3990-06 I/O Error reported

 

¿ªÔÆÌåÓý

People

?

If you look at the POP, the chapter on ¡®basic I/O ?functions¡¯, there is a chart (in my POP, fig 15-5) that shows the bit assignment for CCW command codes.? The particular code in question is X¡¯18.¡¯ If this is a fmt 0 CCW, that is supposed to be interpreted as a TIC (which is valid) and in the case of a fmt 1 CCW, it is invalid. The message does not indicate the CCW format being used (it should) but, if it is a fmt 1 CCW, the message is correct. IBM (and anybody else) cannot add arbitrary CCW command codes here ¨C the figure indicates where they are allowed. So, this is not a ¡®new¡¯ command code that Hercules cannot understand, it is an error!??

?

Peter Morrison


Re: 3390/3990-06 I/O Error reported

 

Joe Monk wrote:

He's also part of the LzLabs group thats being sued by IBM
over patent/copyright infringement.
It's unclear (to me) whether he actually works FOR LzLabs, or AT LzLabs (i.e. whether he is directly employed by them, or is simply doing contract work for them). His LinkedIn profile says he's self employed.



--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...


Re: 3390/3990-06 I/O Error reported

 

He's also part of the LzLabs group thats being sued by IBM over patent/copyright infringement.

Joe

On Fri, Jan 6, 2023 at 6:18 PM Theodore M Rolle Jr <stercor@...> wrote:
He writes CCW programs in Assembler language.
Documented, too!
He uses MVS 3.8 but it wouldn't hurt to ask....

On Fri, Jan 6, 2023, 18:44 Fish Fish <david.b.trout@...> wrote:
Theodore M Rolle Jr wrote:

> Tommy Sprinkle may be able to help...

How?

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...










Re: 3390/3990-06 I/O Error reported

 

He writes CCW programs in Assembler language.
Documented, too!
He uses MVS 3.8 but it wouldn't hurt to ask....

On Fri, Jan 6, 2023, 18:44 Fish Fish <david.b.trout@...> wrote:
Theodore M Rolle Jr wrote:

> Tommy Sprinkle may be able to help...

How?

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...










Re: 3390/3990-06 I/O Error reported

 

No offense, but I think Tommy has enough on his plate...

Joe

On Fri, Jan 6, 2023 at 4:57 PM Theodore M Rolle Jr <stercor@...> wrote:
Tommy Sprinkle may be able to help...

On Fri, Jan 6, 2023, 15:18 Fish Fish <david.b.trout@...> wrote:
Jo?o Reginato wrote:

[...]
> Everything works fine but this message below is always present
> for all my devices after IPL z/os.
>
> HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100 00000000
> HHC01312I 0:2107 CHAN: stat 0E00, count 0000
> HHC01313I 0:2107 CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000
> 00000000 00000080 0002BF0B
> HHC01314I 0:2107 CHAN: sense CMDREJ

[...]
> What is wrong and what can be done to avoid this situation?

What is wrong? Nothing.

What can be done to avoid it? Nothing! :)

Nothing is really wrong with Hercules OTHER than possibly the fact that it does not currently support that particular CCW opcode.

If we could locate documentation somewhere that explains what that particular CCW opcode is (what it does and how it's used), then we *might* be able to MAYBE add support for it. (Maybe)

But since we don't have the documentation for it and thus have no idea what it does or how it's used, that makes it kind of difficult/impossible for us to support it. ;-)

As Jay Maynard explained in his reply, it's not uncommon for IBM to update their operating system to issue new commands to devices that THEY (IBM) know are supported (by *real* 3390s) but which are not publicly documented anywhere. THEY (IBM) probably have internal documentation that explains it, but it's not something they wish to make public for whatever reason.

As you've already noticed however, supporting it is apparently not that critical though, since the system appears to run just fine without it, so my only advice to you would be to simply ignore it.

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...










Re: 3390/3990-06 I/O Error reported

 

Theodore M Rolle Jr wrote:

Tommy Sprinkle may be able to help...
How?

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...


Re: 3390/3990-06 I/O Error reported

 

Tommy Sprinkle may be able to help...


On Fri, Jan 6, 2023, 15:18 Fish Fish <david.b.trout@...> wrote:
Jo?o Reginato wrote:

[...]
> Everything works fine but this message below is always present
> for all my devices after IPL z/os.
>
> HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100 00000000
> HHC01312I 0:2107 CHAN: stat 0E00, count 0000
> HHC01313I 0:2107 CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000
> 00000000 00000080 0002BF0B
> HHC01314I 0:2107 CHAN: sense CMDREJ

[...]
> What is wrong and what can be done to avoid this situation?

What is wrong? Nothing.

What can be done to avoid it? Nothing! :)

Nothing is really wrong with Hercules OTHER than possibly the fact that it does not currently support that particular CCW opcode.

If we could locate documentation somewhere that explains what that particular CCW opcode is (what it does and how it's used), then we *might* be able to MAYBE add support for it. (Maybe)

But since we don't have the documentation for it and thus have no idea what it does or how it's used, that makes it kind of difficult/impossible for us to support it. ;-)

As Jay Maynard explained in his reply, it's not uncommon for IBM to update their operating system to issue new commands to devices that THEY (IBM) know are supported (by *real* 3390s) but which are not publicly documented anywhere. THEY (IBM) probably have internal documentation that explains it, but it's not something they wish to make public for whatever reason.

As you've already noticed however, supporting it is apparently not that critical though, since the system appears to run just fine without it, so my only advice to you would be to simply ignore it.

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...










Re: 3390/3990-06 I/O Error reported

 

Ok thank you

-----Mensagem original-----
De: [email protected] <[email protected]> Em nome de Fish Fish
Enviada em: sexta-feira, 6 de janeiro de 2023 17:18
Para: [email protected]
Assunto: Re: [H390-MVS] 3390/3990-06 I/O Error reported

Jo?o Reginato wrote:

[...]
Everything works fine but this message below is always present for all
my devices after IPL z/os.

HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100
00000000 HHC01312I 0:2107 CHAN: stat 0E00, count 0000 HHC01313I 0:2107
CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000
00000000 00000080 0002BF0B
HHC01314I 0:2107 CHAN: sense CMDREJ
[...]
What is wrong and what can be done to avoid this situation?
What is wrong? Nothing.

What can be done to avoid it? Nothing! :)

Nothing is really wrong with Hercules OTHER than possibly the fact that it
does not currently support that particular CCW opcode.

If we could locate documentation somewhere that explains what that
particular CCW opcode is (what it does and how it's used), then we *might*
be able to MAYBE add support for it. (Maybe)

But since we don't have the documentation for it and thus have no idea what
it does or how it's used, that makes it kind of difficult/impossible for us
to support it. ;-)

As Jay Maynard explained in his reply, it's not uncommon for IBM to update
their operating system to issue new commands to devices that THEY (IBM) know
are supported (by *real* 3390s) but which are not publicly documented
anywhere. THEY (IBM) probably have internal documentation that explains it,
but it's not something they wish to make public for whatever reason.

As you've already noticed however, supporting it is apparently not that
critical though, since the system appears to run just fine without it, so my
only advice to you would be to simply ignore it.

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...












--
att.
Jo?o


Re: 3390/3990-06 I/O Error reported

 

Jo?o Reginato wrote:

[...]
Everything works fine but this message below is always present
for all my devices after IPL z/os.

HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100 00000000
HHC01312I 0:2107 CHAN: stat 0E00, count 0000
HHC01313I 0:2107 CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000
00000000 00000080 0002BF0B
HHC01314I 0:2107 CHAN: sense CMDREJ
[...]
What is wrong and what can be done to avoid this situation?
What is wrong? Nothing.

What can be done to avoid it? Nothing! :)

Nothing is really wrong with Hercules OTHER than possibly the fact that it does not currently support that particular CCW opcode.

If we could locate documentation somewhere that explains what that particular CCW opcode is (what it does and how it's used), then we *might* be able to MAYBE add support for it. (Maybe)

But since we don't have the documentation for it and thus have no idea what it does or how it's used, that makes it kind of difficult/impossible for us to support it. ;-)

As Jay Maynard explained in his reply, it's not uncommon for IBM to update their operating system to issue new commands to devices that THEY (IBM) know are supported (by *real* 3390s) but which are not publicly documented anywhere. THEY (IBM) probably have internal documentation that explains it, but it's not something they wish to make public for whatever reason.

As you've already noticed however, supporting it is apparently not that critical though, since the system appears to run just fine without it, so my only advice to you would be to simply ignore it.

--
"Fish" (David B. Trout)
Software Development Laboratories

mail: fish@...


Re: ChapGPT

 

¿ªÔÆÌåÓý

According to chatgpt..

image
At this point I would like to point out that I think chatgpt is great for creative writing but it is still very much a work in progress for math and perhaps writing code..just my opinion..

Air 2

On Jan 6, 2023, at 10:03 AM, Martin Taylor via groups.io <mtayloribm360@...> wrote:

?

I seem to remember that STOP RUN had to used in a DOS-VSE program where as GOBACK could be used in MVS code.?
Perhaps other can verify my failing memory ;-)

Regards
Martin.


Re: ChapGPT

Martin Taylor
 

I seem to remember that STOP RUN had to used in a DOS-VSE program where as GOBACK could be used in MVS code.?
Perhaps other can verify my failing memory ;-)

Regards
Martin.


Re: Trying to migrate TUN networking connection to TAP

 

Hello Harold,

thanks for chiming in!


Am 05.01.2023 um 21:05 schrieb Harold Grovesteen <h.grovsteen@...>:

You are on the right track. Can you look at any stats that show dropped packets? This might tell you how far the response got before it could not make it to the host.
Not sure if something not there can be counted. I think the only option I have is to check at each possible "tap" if things look complete, or not.

Also, it is a little unclear which component you are wanting to respond with the ARP? OMVS or the host based bridge.
Well, only things with an IP address are supposed to "speak" ARP. So it's the TCP/IP stack of OS/390 I suppose to respond. The host based bridge should be transparent, because it's not involved with L3 processing.

That this setup works in general is proven by the same bridge-group including a separate LCS device using SNA. And I do have a working connection to my AS/400 on Ethernet.

Can you get the bridge to do a packet trace?
I have not yet found out. But I can tcpdump on either side of the bridge and the packets I see are the same.

All in all, I've come to the conclusion that I probably have at least one configuration error in the TCPIP profile. Therefore I should read though the TCP/IP manual(s) being available. This is on my (seemingly endless) ToDo-List. :-)

I also should have a closer look about the encapsulation being used: Everybody speaks Ethernet II for IP. But as Grant Taylor pointed out, 802.2 LLC might be involved on the mainframe side.

It does not look like the host is getting any packets from the bridge. Either the bridge is not sending them, or TCPIP or LCS is dropping them.

I, like you, find the two different MAC addresses concerning.
Are they? Ian Shorter once pointed out that a TAP interface is just a L2 "pipe". The host side is an ordinary network interface, and the other (within Hercules) is API calls. You configure the "base" MAC with the ip command and the other side automatically is configured with that MAC + 1. I didn't take my time to find this in the official tuntap documentation. But it makes sense. One can *probably* change the guest side's MAC with an API call from within the guest.

I am back to a packet trace, if you can manage one from something. I would try to get the host and bridge to use the same MAC addresses preferably through configuration (somewhere).
Every switch (aka multiport-bridge) has MAC addresses on each port, because if (for any reason) the bridge must generate a packet by itself, it has a valid "return" address.

So, I'd rather not. If the bridge has a local MAC equal to the "output of the funnel" within Hercules, I bet packets won't be forwarded anymore: The L2 code in the kernel assumes they're addressed to itself. So they clearly must be distinct.

But MAC addresses might not be the problem.
I also thought about MAC addresses once. On a second look, they largely don't matter, because they're not involved in the packet forwarding process at all. Only the endpoints' MAC addresses matter. It's the learning and MAC table which matters. I just looked up the proper command for the Linux bridge: brctl showmacs [bridge]

Purging of inactive ARP cache entries is normal for ARP caches. It is why in some cases a static ARP cache entry is helpful.
I'm aware. :-)

But since I didn't find out how to set a static ARP entry on OS/390, there was no further diagnosing.

Thank you for your input! As said, I need to review the documentation at this point. I'm sure the culprit is either there, or an encapsulation mismatch.

:wq! PoC


Re: 3390/3990-06 I/O Error reported

 

It's not unusual for the system to issue channel commands in the expectation they will fail. It does this to see if particular capabilities are present. You can ignore the error if it does not cause problems for the running system.


On Fri, Jan 6, 2023 at 7:32 AM Jo?o Reginato <jb.reginato@...> wrote:

Hi

?

I¡¯m using Hyperion 4.5 as below

HHC01413I Hercules version 4.5.0.10830-SDL-g58578601????????????????????????????????????? ??????????????????????????????

HHC01414I (C) Copyright 1999-2022 by Roger Bowler, Jan Jaeger, and others??????????????????????????????????????????????

HHC01417I ** The SoftDevLabs version of Hercules **?????????????????????????????????????????????????????? ??????????????

HHC01415I Build date: Nov 26 2022 at 16:25:41??????????????????????????????????????????????????????????????????????????

HHC01417I Built with: Microsoft Visual Studio 2008 (MSVC 150030729 1)??????????????????????????????????????????????????

HHC01417I Build type: Windows MSVC AMD64 host architecture build???????????????????????????????????????????????????????

?

All my dasd devices are defined as 3390 with CU=3990-6.

Everything works fine but this message below is always present for all my devices after IPL z/os.

?

HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100 00000000????????? ............?????????????????????????

HHC01312I 0:2107 CHAN: stat 0E00, count 0000???????????????????????????????????????????????????????????????????????????

HHC01313I 0:2107 CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000 00000000 00000080 0002BF0B???????????????????

HHC01314I 0:2107 CHAN: sense CMDREJ???????????

?

Even using old Hyperion versions the same always occurred.

What is wrong and what can be done to avoid this situation?

?

TIA

Jo?o

?

?


N?o cont¨¦m v¨ªrus.

--
att.
Jo?o



--
Jay Maynard


3390/3990-06 I/O Error reported

 

¿ªÔÆÌåÓý

Hi

?

I¡¯m using Hyperion 4.5 as below

HHC01413I Hercules version 4.5.0.10830-SDL-g58578601????????????????????????????????????? ??????????????????????????????

HHC01414I (C) Copyright 1999-2022 by Roger Bowler, Jan Jaeger, and others??????????????????????????????????????????????

HHC01417I ** The SoftDevLabs version of Hercules **?????????????????????????????????????????????????????? ??????????????

HHC01415I Build date: Nov 26 2022 at 16:25:41??????????????????????????????????????????????????????????????????????????

HHC01417I Built with: Microsoft Visual Studio 2008 (MSVC 150030729 1)??????????????????????????????????????????????????

HHC01417I Build type: Windows MSVC AMD64 host architecture build???????????????????????????????????????????????????????

?

All my dasd devices are defined as 3390 with CU=3990-6.

Everything works fine but this message below is always present for all my devices after IPL z/os.

?

HHC01315I 0:2107 CHAN: ccw F760000C 7E84DF58=>18000000 00004100 00000000????????? ............?????????????????????????

HHC01312I 0:2107 CHAN: stat 0E00, count 0000???????????????????????????????????????????????????????????????????????????

HHC01313I 0:2107 CHAN: sense 80000000 00FFFF01 00000000 00000000 00000000 00000000 00000080 0002BF0B???????????????????

HHC01314I 0:2107 CHAN: sense CMDREJ???????????

?

Even using old Hyperion versions the same always occurred.

What is wrong and what can be done to avoid this situation?

?

TIA

Jo?o

?

?


N?o cont¨¦m v¨ªrus.

--
att.
Jo?o


Re: ChapGPT

 

Goback exits the program, not any loop within the program. Using stop
run within a subroutine would exit to the operating system and not to
the calling program.

On Fri, Jan 6, 2023 at 2:25 AM Don.isenstadt <don.isenstadt@...> wrote:

Bob,

I used write a complete cobol program¡­ also you can use regenerate and it might add the working storage. I liked the explanation at the end..

Did it write the program or did it ¡°find¡± it? Could not get it to use goback.

So I asked GPT why it does not use goback..


Using "STOP RUN" terminates the entire program and closes all files. "GOBACK" simply exits the current PERFORM or READ loop and returns control to the beginning of the loop. In this case, using "GOBACK" instead of "STOP RUN" would cause the program to continuously loop through the file, reading and printing each record indefinitely. "STOP RUN" is used to end the program after all records have been read and printed.

That is perhaps why it gets away without the working storage flag?


IDENTIFICATION DIVISION.

PROGRAM-ID. READ-AND-PRINT.


ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT INPUT-FILE ASSIGN TO "input.txt"

ORGANIZATION IS SEQUENTIAL.


DATA DIVISION.

FILE SECTION.

FD INPUT-FILE.

01 INPUT-RECORD.

02 INPUT-FIELD PIC X(30).


WORKING-STORAGE SECTION.

01 EOF-FLAG PIC X VALUE 'N'.


PROCEDURE DIVISION.

OPEN INPUT INPUT-FILE

PERFORM UNTIL EOF-FLAG = 'Y'

READ INPUT-FILE

AT END MOVE 'Y' TO EOF-FLAG

END-READ

DISPLAY INPUT-FIELD

END-PERFORM

CLOSE INPUT-FILE

STOP RUN.


Explanation:

The IDENTIFICATION DIVISION and PROGRAM-ID paragraphs are used to identify the program.

The ENVIRONMENT DIVISION contains the INPUT-OUTPUT SECTION, where we specify the input file and its organization (in this case, sequential).

The DATA DIVISION contains the FILE SECTION, where we define the input file and its record layout (in this case, a single field of 30 characters).

The WORKING-STORAGE SECTION is used to define any variables or flags that we need to use in our program. In this case, we define a flag EOF-FLAG to keep track of whether we have reached the end of the file.

In the PROCEDURE DIVISION, we open the input file, then perform a loop until we reach the end of the file. Inside the loop, we read a record from the file and display it. If the end of the file is reached, we set the EOF-FLAG to 'Y' to signal that the loop should terminate. Finally, we close the input file and stop the program.







Air 2

On Jan 6, 2023, at 1:43 AM, Bob Flanders <bob.flanders@...> wrote:

--
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?


Re: ChapGPT

 

¿ªÔÆÌåÓý

Bob,

I used write a complete cobol program¡­ also you can use regenerate and it might add the working storage. I liked the explanation at the end..

Did it write the program or did it ¡°find¡± it? Could not get it to use goback.

So I asked GPT why it does not use goback..


Using "STOP RUN" terminates the entire program and closes all files. "GOBACK" simply exits the current PERFORM or READ loop and returns control to the beginning of the loop. In this case, using "GOBACK" instead of "STOP RUN" would cause the program to continuously loop through the file, reading and printing each record indefinitely. "STOP RUN" is used to end the program after all records have been read and printed.

That is perhaps why it gets away without the working storage flag?


IDENTIFICATION DIVISION.

PROGRAM-ID. READ-AND-PRINT.


ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

???SELECT INPUT-FILE ASSIGN TO "input.txt"

???ORGANIZATION IS SEQUENTIAL.


DATA DIVISION.

FILE SECTION.

???FD INPUT-FILE.

???01 INPUT-RECORD.

?? ? ??02 INPUT-FIELD PIC X(30).


WORKING-STORAGE SECTION.

???01 EOF-FLAG PIC X VALUE 'N'.


PROCEDURE DIVISION.

???OPEN INPUT INPUT-FILE

???PERFORM UNTIL EOF-FLAG = 'Y'

? ? ??READ INPUT-FILE

?? ? ? ??AT END MOVE 'Y' TO EOF-FLAG

? ? ??END-READ

? ? ??DISPLAY INPUT-FIELD

???END-PERFORM

???CLOSE INPUT-FILE

???STOP RUN.


Explanation:

The IDENTIFICATION DIVISION and PROGRAM-ID paragraphs are used to identify the program.

The ENVIRONMENT DIVISION contains the INPUT-OUTPUT SECTION, where we specify the input file and its organization (in this case, sequential).

The DATA DIVISION contains the FILE SECTION, where we define the input file and its record layout (in this case, a single field of 30 characters).

The WORKING-STORAGE SECTION is used to define any variables or flags that we need to use in our program. In this case, we define a flag?EOF-FLAG?to keep track of whether we have reached the end of the file.

In the PROCEDURE DIVISION, we open the input file, then perform a loop until we reach the end of the file. Inside the loop, we read a record from the file and display it. If the end of the file is reached, we set the?EOF-FLAG?to 'Y' to signal that the loop should terminate. Finally, we close the input file and stop the program.







Air 2

On Jan 6, 2023, at 1:43 AM, Bob Flanders <bob.flanders@...> wrote: