View previous topic :: View next topic |
Author |
Message |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Feb 07, 2006 1:20 am Post subject: TRIM function not working ... |
|
|
Hi,
I want to eliminate the trailing spaces from a variable called WW-USR-SNME. I am using TRIM function for the same but it is not recognised by the compiler. My code is below -
STRING TRIM (WW-USR-SNME,RIGHT)
DELIMITED BY SIZE
INTO WW-USR-SNME1
Please suggest a way to do so.
Thanks
Nancy |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Tue Feb 07, 2006 2:26 am Post subject: |
|
|
I think you're missing the word FUNCTION before the function name.
O.
________
Grand Cherokee 5.9
Last edited by ofer71 on Sat Feb 05, 2011 11:31 am; edited 1 time in total |
|
Back to top |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Feb 07, 2006 2:28 am Post subject: |
|
|
Well, I've tried with that option too. Its not working
Nancy |
|
Back to top |
|
 |
vst Beginner
Joined: 23 Jan 2006 Posts: 11 Topics: 0
|
Posted: Tue Feb 07, 2006 4:19 am Post subject: |
|
|
Nancy,
could you please let us know
1) what compiler/version are you using?
2) what does exactly mean "Its not working"? (compiler message(s) regarding TRIM function; DISPLAY WW-USR-SNME/WW-USR-SNME1)
There are too many cases leading to "not working".
(May be some copybook is missing if your compiler does not define intrinsic TRIM function) |
|
Back to top |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Feb 07, 2006 4:47 am Post subject: |
|
|
vst,
I am not sure of the Compiler version but copying few of the details below from the JCL output.
*************************************************************
*
* COMPILE LISTING - KEYWORD **CM
*
*************************************************************
PP 5648-A25 IBM COBOL for OS/390 & VM 2.2.2
Invocation parameters:
FLAG(I,E),MAP,NOSEQ,XREF,NODYNAM,TRUNC(BIN),FSRT
PROCESS(CBL) statements:
CBL SQL("HOST(IBMCOB),APOST,APOSTSQL,VERSION(AUTO)")
CBL TEST(NONE,SYM)
PP 5648-A25 IBM COBOL for OS/390 & VM 2.2.2
The error message is --> IGYPS2121-S "TRIM" was not defined as a data-name.
Please let me know if you need any more details. I would try to provide the same.
Nancy |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Tue Feb 07, 2006 6:39 am Post subject: |
|
|
According to my manual, there is no TRIM function in COBOL for OS/390 & VM 2.2
O.
________
medical marijuana patient
Last edited by ofer71 on Sat Feb 05, 2011 11:31 am; edited 1 time in total |
|
Back to top |
|
 |
Nancy Beginner
Joined: 23 May 2003 Posts: 77 Topics: 26
|
Posted: Tue Feb 07, 2006 6:51 am Post subject: |
|
|
Oh, but I got this code in net. Can you please suggest which version supports the TRIM function in Cobol ?
Nancy |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Tue Feb 07, 2006 7:21 am Post subject: |
|
|
It's probably one of the "PC based" versions of COBOL. Unfortunatilly, I don't have the manuals for these.
O.
________
Ford Windstar
Last edited by ofer71 on Sat Feb 05, 2011 11:31 am; edited 1 time in total |
|
Back to top |
|
 |
vst Beginner
Joined: 23 Jan 2006 Posts: 11 Topics: 0
|
Posted: Tue Feb 07, 2006 8:55 am Post subject: |
|
|
I would add a link containing similar discussion.
http://www.codecomments.com/archive266-2004-12-348732.html
I do not see TRIM function in my Enterprise COBOL V3R2 language reference.
You probably have to write your own (or find any or find workaround). |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Bithead Advanced

Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Tue Feb 07, 2006 10:31 am Post subject: |
|
|
Just a thought.
You could use STRING WW-USR-SNME DELIMITED BY SPACES INTO WW-USR-SNME1.
However, if WW-USR-SNME1 is longer than the truncated value of WW-USR-SNME, COBOL will pad it with trailing spaces. |
|
Back to top |
|
 |
exitroutine Beginner

Joined: 13 Dec 2005 Posts: 1 Topics: 0 Location: Third Rock From The Sun
|
Posted: Thu Feb 09, 2006 3:20 am Post subject: |
|
|
Quote: |
You could use STRING WW-USR-SNME DELIMITED BY SPACES INTO WW-USR-SNME1. |
One Simple query, will the above work if the variable WW-USR-SNME has value "AAAAA B. CCCCCC " where there are 2 embedded spaces in between and there are some trailing spaces at the end which has to removed.
Regards
Exit Routine _________________ Exit Routine,
The Way Out .
"There's always a first time" |
|
Back to top |
|
 |
|
|