Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

PL/I code conversion from COBOL source.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Wed Mar 20, 2013 12:27 pm    Post subject: PL/I code conversion from COBOL source.
Reply with quote

Hi All,
I working PL/I program conversion from COBOLsource.
I want to know following COBOL code is to be converted to
PL/I code.
05. CONVCODE PIC S9(005)
LEADING SEPARATE.
Please let me know what is PL/I code.

Thanks,
Mansik
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Mar 20, 2013 1:42 pm    Post subject:
Reply with quote

I believe it would be

Code:
 5   CONVCODE   PIC'S99999',


Garry.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 20, 2013 1:46 pm    Post subject:
Reply with quote

Why do you've two different post on the same topic: http://ibmmainframes.com/viewtopic.php?t=60660&highlight= ?

What you show is a correct definition or should it be:

Quote:
05 CONVCODE PIC S9(005) SIGN LEADING SEPARATE.
and no "." after Level-05?

On the other hand, these links might be of use:

http://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.enterprisedeveloper.vs%2FBKPUPULANGS046.html and
http://support.microsoft.com/kb/183179
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Wed Mar 20, 2013 1:52 pm    Post subject: My miss spelled.
Reply with quote

I write this topic on mt iphone.

So take miss spelled.

05 CONVCODE PIC S9(005).

I think same to "FIXED DEC(005)" in PL/I.

Please confirm.

Thanks,
Mansik.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Mar 20, 2013 2:02 pm    Post subject:
Reply with quote

This should work:

Code:

DCL 05   CONVCODE   PIC'-99999';
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Mar 20, 2013 2:04 pm    Post subject:
Reply with quote

Quote:
05 CONVCODE PIC S9(005).

I think same to "FIXED DEC(005)" in PL/I.



I don't think so - the Cobol field is not a COMP-3 field.

Garry.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Mar 20, 2013 2:05 pm    Post subject:
Reply with quote

mistah kurtz wrote:
This should work:

Code:

DCL 05   CONVCODE   PIC'-99999';


... and if the sign is positive ?

Garry.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Mar 20, 2013 2:08 pm    Post subject:
Reply with quote

Quote:


... and if the sign is positive ?


oops..sorry..in that case it would have space..
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Wed Mar 20, 2013 2:09 pm    Post subject: My miss spelled.
Reply with quote

Thank you for your reply.

I write this topic on mt iphone.

So take miss spelled.

05 CONVCODE PIC S9(005).

I think same to "FIXED DEC(005)" in PL/I.

Please confirm.

Thanks,
Mansik.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 20, 2013 3:00 pm    Post subject: Re: My miss spelled.
Reply with quote

Mansik Kim wrote:
I write this topic on mt iphone.
Mansik - should I suggest not to use that? icon_smile.gif

You've posted the same topic twice and an another question twice for which Garry has already given an answer.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Mar 20, 2013 3:16 pm    Post subject:
Reply with quote

The TS being a "Software Consualtant" is probably very busy consulting a lot of different parties at the same time so a duplicate is very easily made.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 3:50 pm    Post subject:
Reply with quote

Mansik Kim wrote:
I write this topic on mt iphone.

Ah; a dumbphone.
Garry Carroll wrote:
mistah kurtz wrote:
This should work:

Code:

DCL 05   CONVCODE   PIC'-99999';


... and if the sign is positive ?

Depends on what the implications of LEADING SEPARATE are in COBOL (it's been a few decades, and I've forgotten), but PIC 'S(5)9' would give a "+" if the value is >= 0, and "-" otherwise. PIC '+(5)9' and '-(5)9' will give signs only if >=0 and <0, respectively.

And, of course, you wouldn't declare an 05-level variable in PL/I, any more than you would in COBOL; the code would be like
Code:
DCL 1  FOO UNAL,
       5  CONVCODE PIC 'S(5)9',
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 20, 2013 6:54 pm    Post subject:
Reply with quote

Quote:
PIC '+(5)9' and '-(5)9' will give signs only if >=0 and <0, respectively.
Akatsukami - I hope 'am not interpreting it wrong, however in COBOL - for minus sign -- if the sending item is negative, a minus sign is printed. If the sending item is positive, a space is printed instead. And for Plus sign -- if the sending item is negative, a minus in printed and if the sending item is positive, a plus is inserted. Later is used when one always want the sign printed.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Mar 20, 2013 7:18 pm    Post subject: Reply to: PL/I code conversion from COBOL source.
Reply with quote

Quote:
Please let me know what is PL/I code.


can You read ???
here is the link to the PL/1 manuals
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH360
or
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH370

where You will find all You might want to know about PICs
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Wed Mar 20, 2013 7:28 pm    Post subject:
Reply with quote

Code:
DCL P1 PIC 's9';                 
DCL P2 PIC '+9';                 
DCL P3 PIC '-9';                 
                                 
P1,P2,P3 =  1; PUT DATA(P1,P2,P3);
P1,P2,P3 = -1; PUT DATA(P1,P2,P3);


Output:

Code:
P1=+1
P2=+1
P3= 1;

P1=-1
P2= 1
P3=-1;


And in PL/I you use only FIXED DEC until the very last moment, i.e. the moment that you put your data into a format that needs to be read by mere mortals. Doing calculations with PIC variables is bad, very bad!
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 7:41 pm    Post subject:
Reply with quote

Anuj Dhawan wrote:
Quote:
PIC '+(5)9' and '-(5)9' will give signs only if >=0 and <0, respectively.
Akatsukami - I hope 'am not interpreting it wrong, however in COBOL - for minus sign -- if the sending item is negative, a minus sign is printed. If the sending item is positive, a space is printed instead. And for Plus sign -- if the sending item is negative, a minus in printed and if the sending item is positive, a plus is inserted. Later is used when one always want the sign printed.

That is true of COBOL; in PL/I, however, a "+" in the picture will print a space if the value is negative. A "S" prints either plus or minus sign depending on value.

ETA: After I wrote this, I noticed Mr. Prins' examples.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Mar 20, 2013 8:05 pm    Post subject:
Reply with quote

Okay, we both stand corrected but my intrepretation was wrong... icon_redface.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 8:20 pm    Post subject:
Reply with quote

Not a problem; even I've been known to make mistakes icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 3 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us