Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Removing Space from Alphanumeric edited item

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

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Tue Jan 16, 2007 3:33 pm    Post subject: Removing Space from Alphanumeric edited item
Reply with quote

Hello All,
I have a record like this
01 delta-record
05 acct-num PIC x(10) VALUE SPACE.
05 comma PIC x(01) VALUE ','.
05 Address PIC x(20) VALUE SPACE.

But acutally acct-num data item will be populated with the data of legth 5, so the records are written with the spaces like shown below.

23456 ,house # 1 bsk ramanagaram
42358 , 786 bangalore

I want to supress the spaces which are inserted due to acc-num data item, keeping the legth of the dataitem as 10 itself, please suggest me the editing character for doing this.

Thanks in advance
Venkat
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 3:58 pm    Post subject:
Reply with quote

Assuming COBOL:
compute acct-num = function numval (acct-num)
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Tue Jan 16, 2007 4:21 pm    Post subject: Re: Alphanumeric edited item
Reply with quote

Hi William,
acct-num is a alphanumeric item, so is it possible to use NUMVAL function on alphanumeric data item?

With regs
Venkat
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:25 pm    Post subject:
Reply with quote

My bad....
the source field "must be a nonnumeric literal or an alphanumeric data item" but the recieving field should have been numeric...
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Tue Jan 16, 2007 4:35 pm    Post subject: Re: Alphanumeric edited item
Reply with quote

This data item may also contain non-numeric data in it, so I think this will not work, is there any editing chars we can use to supress the SPACES..like how we supress zeros using Z in numeric dataitems.

Thanks
Venkat
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:53 pm    Post subject:
Reply with quote

The only requirement is that at least one numeric character must exist in the source field.
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Tue Jan 16, 2007 6:42 pm    Post subject: Re: Removing Space from Alphanumeric edited item
Reply with quote

Thanks William,

Now, I have another problem, since receiving filed should be capable of holding maximum 10 chars, I have declared it as X(10)...so still spaces are written into the file.

Is there any way to declare a variable of variable length?

thanks
Venkat
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 6:46 pm    Post subject: Re: Removing Space from Alphanumeric edited item
Reply with quote

venktv wrote:
TNow, I have another problem, since receiving filed should be capable of holding maximum 10 chars, I have declared it as X(10)...so still spaces are written into the file.
Is there any way to declare a variable of variable length?
Declare it as 9(10), that'll stop those pesky spaces..... icon_lol.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Tue Jan 16, 2007 7:55 pm    Post subject:
Reply with quote

Maybe the STRING command will come in handy:
Instead of:
Code:
01 delta-record
   05 acct-num PIC x(10) VALUE SPACE.
   05 comma PIC x(01) VALUE ','.
   05 Address PIC x(20) VALUE SPACE.
use only:
Code:
01  delta-record   PIC X(31).


and instead of moving the 2 fields (acct-num and Address) do a:
Code:
    STRING input-acct-num DELIMITED BY SPACE
          ','             DELIMITED BY SIZE
          input-address   DELIMITED BY SIZE
    INTO  delta-record

That may solve the problem.
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Wed Jan 17, 2007 12:21 pm    Post subject:
Reply with quote

Hi Marso,
Thanks very much, it is really cool option and working fine...

Hi William,
Thanks very much for your guidance...

With regards
Venkat
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 The TS7720 is out of cache space. Rex Montemayor All Other Mainframe Topics 2 Mon Sep 25, 2017 7:18 am
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts VSAM Space Allocation mrgnndhmk JCL & VSAM 7 Sat Apr 22, 2017 12:42 am
This topic is locked: you cannot edit posts or make replies. Need help in estimating space of unlo... ashek15 IMS DB/DC 12 Fri Apr 07, 2017 5:11 am
No new posts Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am

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