IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Usage of Like statement in PL/I


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

New User


Joined: 15 Nov 2019
Posts: 7
Location: India

PostPosted: Fri Nov 15, 2019 11:22 pm
Reply with quote

Hi,

Is the below syntax valid in PL/I?

DCL A CHAR(10),
B LIKE A,
C LIKE B,
D LIKE C;

This was asked as an interview question.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Nov 16, 2019 1:17 am
Reply with quote

The PL/I Language Reference manual has this example:
Quote:
The following declarations are valid, but only because B is declared before C and E is declared before F:
dcl 1 a, 2 a1 fixed bin;
dcl 1 b, 2 b1 like a;
dcl 1 c, 2 c1 like b;
dcl 1 d, 2 d1 fixed bin;
dcl 1 e like d;
So it appears the interview question's declarations are valid, but I don't have access to a PL/I compiler to verify that.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sat Nov 16, 2019 2:30 am
Reply with quote

Why didn't you look it up in the manual, after the interview?

It may be allowed nowadays, but it wasn't in earlier versions of PL/I (including Enterprise PL/I), and I have my doubts about using like for elementary variables.
Back to top
View user's profile Send private message
Sakthidevi

New User


Joined: 15 Nov 2019
Posts: 7
Location: India

PostPosted: Sat Nov 16, 2019 11:55 am
Reply with quote

Thanks Robert!

I have 13 years of experience in mainframe and currently looking for a change.

Never have seen such a logic. Do people do something as bad as that?
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

 


Similar Topics
Topic Forum Replies
No new posts STEM usage in REXX CLIST & REXX 14
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
Search our Forums:

Back to Top