-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1 new exercise: pig-latin #142
Conversation
whoops, there was a comma missing in config.json fixed now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
01 STARTING-POINT USAGE BINARY-LONG.
01 ITEM-COUNT USAGE BINARY-LONG.
INITIALIZE ITEM-COUNT.
INSPECT WS-INPUT TALLYING ITEM-COUNT FOR ALL SPACE.
UNSTRING WS-INPUT DELIMITED BY ' '
INTO WORDSLIST(ITEM-COUNT)
WITH POINTER STARTING-POINT.
That does however appear to break one of the tests. It's not vital. In one sense the code just has to work, no matter how inefficiently. At another level, you learning to write better COBOL isn't a bad thing.
The code as it is given here leaves the WORDSLIST table empty. So it would need to be changed somehow. In fact I tried looking up some kind of (working example) code from somewhere so that I would not have to write any indices. But I could not find any. I've seen examples with PERFORM UNTIL SOMECHAR = 'Y' and then the UNSTRING contains NOT ON OVERFLOW MOVE 'Y' TO SOMECHAR, but that gives me equally empty table. For example here they do just like I did: https://users.cs.jmu.edu/adamses/Web/CS%20430%20Fall%202004/Student%20Project%20Work/Akanni%20-%20COBOL/COBOL%20Tutorial%20HTML-Pages/The%20UNSTRING%20verb.htm
Aye I don't mind learning, but I do need some sort of source material. |
My apologies. I thought that was working. Hmmm ... shall get back to you. |
See my exploration on onecompiler. I thought COBOL would unstring into the array but, alas, I have to be more explicit about my intention. |
I changed it to UNSTRING WITH POINTER, it's good to know those types of tricks if you have a long string and a resulting table of millions of entries. |
Hi,
please find 1 new exercise to the COBOL track: pig-latin