Get right most characters from field in COBOL

What's the easiest way in COBOL to get 3 characters from the right end of a field.  For example I have a field that is 255 bytes long.  It has a file name in it and may only take up part of the field and the rest will be padded with spaces.  So what I want is to check the extension  of the file name.  So say it's C:\test\test.txt and then padded with spaces so that it's 255 long.  I want the 'txt' part of the file name.  What's the easiest way or maybe least amount of coding to do this.

Thanks.
LVL 1
pmac38CDSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tliottaCommented:
What COBOL compiler? I'd guess it's a PC compiler based on your example file name. The easiest with the compiler that I use is likely not available to you.

Tom
0
pmac38CDSAuthor Commented:
Yes it's with a PC compiler from Fuji COBOL.
0
pmac38CDSAuthor Commented:
This is what i ended up doing that works....

    MOVE LK-MF-FILENAME TO WS-MF-FILENAME.
     PERFORM
           VARYING FILE-LENGTH FROM +255 BY -1
             UNTIL LK-MF-FILENAME(FILE-LENGTH:1) NOT = ' '
           CONTINUE
     END-PERFORM.
     IF FUNCTION UPPER-CASE(LK-MF-FILENAME(FILE-LENGTH + 1 - 3:3)) = 'EMF'
             DO STUFF
     END-IF.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

pmac38CDSAuthor Commented:
This is what i ended up doing that works....

    MOVE LK-MF-FILENAME TO WS-MF-FILENAME.
     PERFORM
           VARYING FILE-LENGTH FROM +255 BY -1
             UNTIL LK-MF-FILENAME(FILE-LENGTH:1) NOT = ' '
           CONTINUE
     END-PERFORM.
     IF FUNCTION UPPER-CASE(LK-MF-FILENAME(FILE-LENGTH + 1 - 3:3)) = 'EMF'
             DO STUFF
     END-IF.
0
tliottaCommented:
My apologies. For some reason, downloads of Fuji COBOL seem to be unavailable. I can't get hold of the compiler nor any reference.

If it helps, you might check to see if it supports a feature called "reference modification". It allows access to substrings in ways that should be helpful.

Tom
0
pmac38CDSAuthor Commented:
I figured it out and there were no other answers.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.