IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Unstring a variable which having value 'bbbbbbbb9,328.32'

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
View previous topic :: View next topic  
Author Message
Anand78



Joined: 06 Mar 2006
Posts: 48
Location: PUNE

Posted: Tue Jul 15, 2008 6:34 pm    Post subject: Unstring a variable which having value 'bbbbbbbb9,328.32'  

Hi,

I have the following rquirement.

I need to unstring a variable which having value 'bbbbbbbb9,328.32'

I want to unstring only when it hits the first chacter not spaces.

here b means space.

After unstring VAR1 should have 9 and VAR2 328.32.

Thanks,
Back to top  
dbzTHEdinosauer



Joined: 20 Oct 2006
Posts: 1639
Location: germany

Posted: Tue Jul 15, 2008 6:54 pm    Post subject:  

Code:
01  WORK-STRING        PIC X(16).

01  UNSTRING-AREA.
     05  FIELD-1             PIC X(16).
     05  FIELD-2             PIC X(16).
     05  FIELD-3             PIC X(16).

UNSTRING  WORK-AREA
                     DELIMITED BY ALL SPACES OR ','
      INTO   FIELD-1
             FIELD-2
             FIELD-3
END-UNSTRING


if there are leading spaces, field-1 will be spaces, field-2 will contain 9 and field-3 will contain the rest.

if there are no leading spaces, field-1 will contain the 9, field-2 will contain the rest and field three will contain spaces.
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM