IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Problem with GOTO


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vinay Pushpala

New User


Joined: 06 Nov 2013
Posts: 21
Location: India

PostPosted: Wed Mar 19, 2014 5:20 pm
Reply with quote

Hi all,

I am using GOTO in my program..
The program has only one error & that is with the GOTO.
The code looks like this.

Code:
IF FLAG_READ_NEXT = 2             
THEN DO;                         
     GOTO NEXT_SAL;               
END; /* END OF 'IF' OF FLAG = 2 */


Error message of the GOTO:

IDENTIFIER 'NEXT_IMS' AFTER 'GOTO' IS NOT A LABEL KNOWN IN THE CURRENT BLOCK. STATEMENT IGNORED

The GOTO is written in one PROC and LABEL of GOTO is in another PROC of the same program.

NEXT_SAL:
READ FILE (SAMPLE) INTO (SAMPLE_REC);

The proc ends after the read statement.
The label is not present in any "IF CONDITIONS, DO LOOPS, SELECT ".

I am unable to fix this error.
Any help on this issue would be appreciated.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Wed Mar 19, 2014 5:34 pm
Reply with quote

The error message says NEXT_IMS, so you are showing/looking-at the wrong code anyway.
Back to top
View user's profile Send private message
Vinay Pushpala

New User


Joined: 06 Nov 2013
Posts: 21
Location: India

PostPosted: Wed Mar 19, 2014 5:35 pm
Reply with quote

Sorry for the mistake Woodger..
that was a typo..
It should be NEXT_SAL
Back to top
View user's profile Send private message
Vinay Pushpala

New User


Joined: 06 Nov 2013
Posts: 21
Location: India

PostPosted: Wed Mar 19, 2014 5:43 pm
Reply with quote

Got it..
The GOTO was in a two level procedure..
It was the problem..
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2432
Location: Hampshire, UK

PostPosted: Wed Mar 19, 2014 5:55 pm
Reply with quote

Your problem is using GOTO - it should only ever be used in the ON ERROR block. Every other use is bad design.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 19, 2014 10:35 pm
Reply with quote

I agree with Nic. PL/I is a marvelous HLL (eclipses COBOL) and should only require the use of GOTO's (as he has said) in ON ERROR blocks.

When I was coding PL/I (some 30 years ago), we were forbidden to use GOTO's and rightly so, except for exiting E15 and E35 PL/I Sort Exits. These are akin to a COBOL SORT INPUT PROCEDURE (E15) and OUTPUT PROCEDURE (E35).

HTH....
Back to top
View user's profile Send private message
Vinay Pushpala

New User


Joined: 06 Nov 2013
Posts: 21
Location: India

PostPosted: Thu Apr 10, 2014 4:32 pm
Reply with quote

Sorry for the late reply Nic. (you are right abt the problem)
But thanks for the corrections on GOTO.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Problem getting record length of a re... COBOL Programming 2
No new posts Problem while trying to manipulate re... DFSORT/ICETOOL 3
No new posts TSO IOF problem TSO/ISPF 5
No new posts Need help with this dfsort problem DFSORT/ICETOOL 7
No new posts Having problem passing a variable to ... JCL & VSAM 12

Back to Top