Cobol TRIM



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: Cobol TRIM

Postby Robert Sample » Thu Dec 15, 2022 7:46 pm

Is it possible to do that in some way?
Yes:
move 'leading' to option
IF OPTION = 'LEADING'
THEN move function trim(checkfield, 'LEADING') to field
ELSE move function trim(checkfield, 'TRAILING') to field
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Cobol TRIM

Postby LasseH » Thu Dec 15, 2022 8:11 pm

Yes but it would have worked if they had put the option in quotes like 'leading' 'trailing' instead of using "reserved" word(s)
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Cobol TRIM

Postby Robert Sample » Thu Dec 15, 2022 9:28 pm

Check the syntax diagram in the Enterprise COBOL Language Reference manual. You can use nothing, or you can use the literal 'LEADING' or you can use the literal 'TRAILING'. What you CANNOT do is to make up your own syntax and expect COBOL to recognize it. This is why your
move function trim(checkfield, option) to field
failed -- you made up your own syntax.

Topic locked as the original question has been answered and we're veering into irrelevant areas.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post