MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TRIM function not working ...

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Feb 07, 2006 1:20 am    Post subject: TRIM function not working ... Reply with quote

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
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Feb 07, 2006 2:26 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Feb 07, 2006 2:28 am    Post subject: Reply with quote

Well, I've tried with that option too. Its not working Sad

Nancy
Back to top
View user's profile Send private message
vst
Beginner


Joined: 23 Jan 2006
Posts: 11
Topics: 0

PostPosted: Tue Feb 07, 2006 4:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Feb 07, 2006 4:47 am    Post subject: Reply with quote

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
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Feb 07, 2006 6:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Tue Feb 07, 2006 6:51 am    Post subject: Reply with quote

Oh, but I got this code in net. Can you please suggest which version supports the TRIM function in Cobol ?

Nancy
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Feb 07, 2006 7:21 am    Post subject: Reply with quote

It's probably one of the "PC based" versions of COBOL. Unfortunatilly, I don't have the manuals for these. Very Happy

O.
________
Ford Windstar


Last edited by ofer71 on Sat Feb 05, 2011 11:31 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
vst
Beginner


Joined: 23 Jan 2006
Posts: 11
Topics: 0

PostPosted: Tue Feb 07, 2006 8:55 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Feb 07, 2006 9:28 am    Post subject: Reply with quote

Quote:

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.

Nancy,

TRIM function is not available on the Mainframe COBOL compiler.

However you can acheive the desired results using INSPECT statement with REVERSE option.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1282&highlight=length

http://www.mvsforums.com/helpboards/viewtopic.php?t=525&highlight=length

http://mvsforums.com/helpboards/viewtopic.php?t=3185&highlight=length

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Tue Feb 07, 2006 10:31 am    Post subject: Reply with quote

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
View user's profile Send private message
exitroutine
Beginner


Joined: 13 Dec 2005
Posts: 1
Topics: 0
Location: Third Rock From The Sun

PostPosted: Thu Feb 09, 2006 3:20 am    Post subject: Reply with quote

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 Smile.
"There's always a first time"
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group