Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SUSBSCRIPT WITH SIGN IN PIC CLAUSE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
RIGICDS32

New User


Joined: 24 Jun 2020
Posts: 4
Location: India

PostPosted: Wed Jun 24, 2020 5:49 pm    Post subject: SUSBSCRIPT WITH SIGN IN PIC CLAUSE
Reply with quote

I am writing this piece of code -
Code:
IDENTIFICATION DIVISION.
program-id. Hello.
data division.
WORKING-STORAGE SECTION.
01 INPUT-RECORD.
   02 VAR1 OCCURS 4 TIMES.
      03 VAR2 PIC X(11) OCCURS 1 TIMES.
      03 VAR22 REDEFINES VAR2 PIC S9(10) SIGN IS LEADING SEPARATE CHARACTER.
PROCEDURE DIVISION.
MOVE '012|323|121|2|1' TO INPUT-RECORD.
UNSTRING INPUT-RECORD DELIMITED BY "|"
                 INTO VAR2(1,1)
              DISPLAY VAR22(1)
stop run.


Output -
12 -

I want to get it displayed as +012.

Thanks for the help in advance.
Back to top
View user's profile Send private message

RIGICDS32

New User


Joined: 24 Jun 2020
Posts: 4
Location: India

PostPosted: Wed Jun 24, 2020 6:31 pm    Post subject: Reply to: SUSBSCRIPT WITH SIGN IN PIC CLAUSE
Reply with quote

Code:
IDENTIFICATION DIVISION.
program-id. Hello.
data division.
WORKING-STORAGE SECTION.
01 INPUT-RECORD.
   02 VAR1 OCCURS 4 TIMES.
      03 VAR2 PIC X(10) OCCURS 1 TIMES.
01 VAR22 PIC S9(10) LEADING.
PROCEDURE DIVISION.
MOVE '012|323|121|2|1' TO INPUT-RECORD.
UNSTRING INPUT-RECORD DELIMITED BY "|"
                 INTO VAR2(1,1)
END-UNSTRING.
MOVE VAR2(1,1) TO VAR22.
DISPLAY VAR22.
stop run.

OUTPUT - +0000000012

It's kinda solved.
Thank you.
Back to top
View user's profile Send private message
RIGICDS32

New User


Joined: 24 Jun 2020
Posts: 4
Location: India

PostPosted: Fri Jun 26, 2020 2:34 pm    Post subject:
Reply with quote

No it's not solved actually.

The subscript thing is adding trailing zeroes to the number.
How to avoid it?
Back to top
View user's profile Send private message
RIGICDS32

New User


Joined: 24 Jun 2020
Posts: 4
Location: India

PostPosted: Fri Jun 26, 2020 3:35 pm    Post subject: Reply to: SUSBSCRIPT WITH SIGN IN PIC CLAUSE
Reply with quote

Solved using numval icon_sad.gif icon_razz.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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Typing the CENT sign ยข on mainframe,... Rod Hittle All Other Mainframe Topics 2 Wed Apr 15, 2020 7:06 pm
No new posts usage of CASE in WHERE clause abdulrafi DB2 10 Wed Mar 18, 2020 4:25 pm
No new posts Cobol redefines for Signed pictured c... gvvjags COBOL Programming 4 Thu Feb 27, 2020 4:33 pm
No new posts KSDS direct READ clause after READ NEXT sophia.lee JCL & VSAM 0 Tue Oct 01, 2019 10:10 am
No new posts Identify who, from where, sign on CIC... Weilin Wen CICS 1 Thu May 09, 2019 1:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us