View previous topic :: View next topic
|
Author |
Message |
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Assuming COBOL:
compute acct-num = function numval (acct-num) |
|
Back to top |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The only requirement is that at least one numeric character must exist in the source field. |
|
Back to top |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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..... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
venktv
New User
Joined: 29 Mar 2006 Posts: 59 Location: Montreal
|
|
|
|
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 |
|
|
|