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

Convert '00n' to 'n<space><space>'


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ankit.jain

New User


Joined: 02 Jul 2009
Posts: 18
Location: Mumbai

PostPosted: Mon Sep 13, 2010 7:26 pm
Reply with quote

Hi,

I have a variable A PIC 9(03) which can have values from 001 to 100. I want to move this field to B defined as PIC X(03). The moved value in field B should be displayed left aligned like from "1 " to "100".

For example if A = 001, B should have value '1<space><space>'.

Please suggest.

Ankit
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 13, 2010 7:35 pm
Reply with quote

Reference modification works well:
Code:
           IF  A < 10
               MOVE A (3 : 1)          TO  B
           ELSE
               IF  A < 100
                   MOVE A (2 : 2)      TO  B
               ELSE
                   MOVE A              TO  B
               END-IF
           END-IF.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top