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

PL/I code conversion from COBOL source.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Mar 20, 2013 1:42 pm
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

Superior Member


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

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

Why do you've two different post on the same topic: 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:

documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.enterprisedeveloper.vs%2FBKPUPULANGS046.html and
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
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: 316
Location: Room: TREE(3). Hilbert's Hotel

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

This should work:

Code:

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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Mar 20, 2013 2:04 pm
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Mar 20, 2013 2:05 pm
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: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Mar 20, 2013 2:08 pm
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
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

Superior Member


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

PostPosted: Wed Mar 20, 2013 3:00 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Mar 20, 2013 3:16 pm
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: 1788
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 3:50 pm
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

Superior Member


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

PostPosted: Wed Mar 20, 2013 6:54 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Mar 20, 2013 7:18 pm
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
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IBMSH360
or
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

Senior Member


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

PostPosted: Wed Mar 20, 2013 7:28 pm
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: 1788
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 7:41 pm
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

Superior Member


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

PostPosted: Wed Mar 20, 2013 8:05 pm
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: 1788
Location: Bloomington, IL

PostPosted: Wed Mar 20, 2013 8:20 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top