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: 8569
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
Warnings : 1

Senior Member


Joined: 07 Feb 2009
Posts: 1238
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 SKIP LOCKED DATA in UPDATE statement DB2 9
No new posts DB2 group member usage DB2 0
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts Any limit on usage of cursors ? DB2 1
Search our Forums:

Back to Top