I don't particular like having disp MOD for an input dataset, but there is probably a good reason.
Looking at the code shown I cannot offhand see why statement 43 does not list data record 79.
I suggest that you display the actual datasetname allocated and then browse that to verify the contents.
Also for a loop that big I personally would choose a more meaníngful control variable than just B, it is all too easy to reassign B somewhere in a subroutine.
REXX program skips an input record
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: REXX program skips an input record
I recommend you to start from the minimal code configuration:
Also you can improve your END statement a little bit:
When you are sure it is working as desired, then start adding other parts of text processing, one logical part at a time. As soon as you are faced your initial issue again, it points to the last added part of code, which needs to be carefully reviewed.
Code: Select all
DO B = 1 TO CUR_LINE.0 /* ! B LOOP */
SAY B CUR_LINE.B
WTO_INDEX1 = INDEX(CUR_LINE.B,'//ST10 ')
CUR_LINE.B = '// '
QUEUE_LINE = CUR_LINE.B /* USE QUEUE_LINE AS OUTPUT */
WTO_INDEX = INDEX(CUR_LINE.B,'//ST10 ')
SAY 'B IS ' B
SAY 'CUR LINE IS ' CUR_LINE.B
END /* ! B LOOP */
Also you can improve your END statement a little bit:
Code: Select all
DO B = 1 TO CUR_LINE.0 /* ! B LOOP */
. . . . . . . . .
END B /* ! B LOOP */
When you are sure it is working as desired, then start adding other parts of text processing, one logical part at a time. As soon as you are faced your initial issue again, it points to the last added part of code, which needs to be carefully reviewed.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Posts: 13
- Joined: Mon Sep 19, 2022 9:19 pm
- Skillset: COBOL
DB2
IMS
REXX
Endevor SCM - Referer: Internet
Re: REXX program skips an input record
Sergeyken, first off, I didn't write this code; the administrator before me wrote it. Second, I do not appreciate you calling the code 'terrible' and a 'mess'. As you have said, you have not read it, so you have no idea if it is terrible or not. As you said, I am trying to be polite, however, it's hard to be polite when I am insulted.
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: REXX program skips an input record
I have read the code, and all I will say is that coding habits differ.
But I will go along with sergeykens suggestion of getting down to the smallest program that will prove or disprove your point. As far as I can tell, something like this should do it:
But I will go along with sergeykens suggestion of getting down to the smallest program that will prove or disprove your point. As far as I can tell, something like this should do it:
Code: Select all
"Allocate da(dsname) dd(dd1) shr"
"Execio * diskr dd1 (stem cur_line. finis)"
"free dd(dd1)"
DO B = 1 TO CUR_LINE.0 /* ! B LOOP */
SAY right(B,6,0) strip(CUR_LINE.B,'t')
END /* ! B LOOP */
- Pedro
- Posts: 686
- Joined: Thu Jul 31, 2008 9:59 pm
- Skillset: ISPF
- Referer: google
- Location: Silicon Valley
Re: REXX program skips an input record
re: "calling the code 'terrible' "
Not sure if it is terrible or not, but it was shown to us without indentations and with line numbers. It is hard to read. I agree with earlier comments about not showing the entirety of the code, but only showing the parts that are pertinent.
Not sure if it is terrible or not, but it was shown to us without indentations and with line numbers. It is hard to read. I agree with earlier comments about not showing the entirety of the code, but only showing the parts that are pertinent.
Pedro Vera
- Pedro
- Posts: 686
- Joined: Thu Jul 31, 2008 9:59 pm
- Skillset: ISPF
- Referer: google
- Location: Silicon Valley
Re: REXX program skips an input record
Willy provided a good way to debug your code.
To debug further, I would add similar code at various spots:
To debug further, I would add similar code at various spots:
Code: Select all
DO _prob = 77 TO 80 /* ! _prob LOOP */
SAY right(_prob,6,0) strip(CUR_LINE._prob,'t')
END /* ! _prob LOOP */
/* your main loop */
DO B = 1 TO CUR_LINE.0 /* ! B LOOP */
...
/* add this in a few spots to narrow source of problem */
DO _prob = 77 TO 80 /* ! _prob LOOP */
SAY right(_prob,6,0) strip(CUR_LINE._prob,'t')
END /* ! _prob LOOP */
...
END /* ! B LOOP */
Pedro Vera
-
- Posts: 13
- Joined: Mon Sep 19, 2022 9:19 pm
- Skillset: COBOL
DB2
IMS
REXX
Endevor SCM - Referer: Internet
Re: REXX program skips an input record
I did not write this program, and I only know a little REXX, so I cannot make comments about how it's written. I am able to read through the program. There are a couple of things that I can see don't need to be done.
I should say first that there is one of two datasets that is being read: a production DB2 bind file and an exception file. In this case, the REXX opens the exception file because it found the bind JCL in that one.
I stripped down the REXX to an open of one of the files and a do loop to display each of the records. When I run through all of the JCL lines, the one line that has the DB2 program in it, line 79 of 359 lines, is skipped.
I tried adding the element to the production dataset and removing it from the exception dataset. When it reads the production dataset, it does not skip the record and writes out all 359 records. Because the production library is PDSE and the exception is PDS, I copied the exception elements into a new PDSE file. That didn't make a difference.
There is something about the exception dataset that it doesn't like.
I should say first that there is one of two datasets that is being read: a production DB2 bind file and an exception file. In this case, the REXX opens the exception file because it found the bind JCL in that one.
I stripped down the REXX to an open of one of the files and a do loop to display each of the records. When I run through all of the JCL lines, the one line that has the DB2 program in it, line 79 of 359 lines, is skipped.
I tried adding the element to the production dataset and removing it from the exception dataset. When it reads the production dataset, it does not skip the record and writes out all 359 records. Because the production library is PDSE and the exception is PDS, I copied the exception elements into a new PDSE file. That didn't make a difference.
There is something about the exception dataset that it doesn't like.
- Pedro
- Posts: 686
- Joined: Thu Jul 31, 2008 9:59 pm
- Skillset: ISPF
- Referer: google
- Location: Silicon Valley
Re: REXX program skips an input record
something about the exception dataset that it doesn't like
Nothing comes to mind about why it would skip a particular line. But, turn hex on and look for non-display characters that you do not expect to be there. Look in the lines before and also the skipped line.
Also, Willy mentioned about the use of MOD in the ALLOC statement. It should probably be SHR instead. I doubt it would cause this problem, but you should eliminate incorrect stuff when you find it.
Pedro Vera
-
- Posts: 13
- Joined: Mon Sep 19, 2022 9:19 pm
- Skillset: COBOL
DB2
IMS
REXX
Endevor SCM - Referer: Internet
Re: REXX program skips an input record
I did as Pedro suggested. It does not see line 79. The first is how the member in the exception library looks, with the DB2 program listed. The second is the display of the REXX displaying those records.
Code: Select all
000077 RELEASE(COMMIT) -
000078 PKLIST( -
000079 DB2SUBR.BC20P007 +
000080 ) -
Code: Select all
1 //DSCCHQ01 JOB (),BIND.EXCEP8,MSGLEVEL=(1,1),
1 //DSCCHQ01 JOB (),BIND.EXCEP8,MSGLEVEL=(1,1),
000077 RELEASE(COMMIT) -
000078 PKLIST( -
000079 ) -
000080 EXPLAIN(N) -
2 // CLASS=A,PRTY=10,TIME=(,10),
2 // CLASS=A,PRTY=10,TIME=(,10),
-
- Posts: 13
- Joined: Mon Sep 19, 2022 9:19 pm
- Skillset: COBOL
DB2
IMS
REXX
Endevor SCM - Referer: Internet
Re: REXX program skips an input record
One of the first things I did was to turn HEX on, to see if there was a character in the line that would cause a problem. I also changed MOD to SHR. Same thing keeps happening.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 2
- 1061
-
by sergeyken
View the latest post
Fri Jul 14, 2023 7:13 pm
-
- 4
- 2883
-
by Pedro
View the latest post
Sat May 15, 2021 3:39 am
-
- 6
- 2535
-
by sergeyken
View the latest post
Wed Nov 24, 2021 11:26 pm
-
-
Can I run a ".qmc" macro in my Rexx program?
by Robledo » Thu Mar 10, 2022 1:28 pm » in CLIST & REXX - 17
- 4995
-
by enrico-sorichetti
View the latest post
Wed Mar 16, 2022 4:39 am
-
-
-
Copy partial record after a string in a record using SORT.
by Esmayeelhusen » Thu May 04, 2023 3:03 pm » in DFSORT/ICETOOL/ICEGENER - 16
- 4218
-
by Esmayeelhusen
View the latest post
Mon May 22, 2023 3:50 pm
-