Cobol TRIM

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

Re: Cobol TRIM

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

Is it possible to do that in some way?
Yes:

Code: Select all

move 'leading' to option
IF OPTION = 'LEADING'
THEN move function trim(checkfield, 'LEADING') to field
ELSE move function trim(checkfield, 'TRAILING') to field

LasseH
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

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)

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.


  • Similar Topics
    Replies
    Views
    Last post