Skip to content
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

Updating the reserved words for COBOL filedef #2021

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DansLeRuSH
Copy link

Adding missing, splitting in two categories and updating COBOL reserved words in order to improve readability

Adding missing, splitting in two categories and updating COBOL reserved words in order to improve readability
@elextr elextr mentioned this pull request Dec 19, 2018
operator's properties no longer useful
@elextr
Copy link
Member

elextr commented Mar 21, 2019

@gsantner no, #1263 is ctags which has nothing to do with the wordlists in the filetypes files which are used by the highlighting lexers.

Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the keywords list?

I found three sources:

Comparing those, you have quite a few items that aren't found in any of them: argument-value asc commarea communications comp-7 comp-8 comp-9 computational-7 computational-8 computational-9 declare delaratives desc distinct environment-value f hold include integer optimize row rows s9 segment-limited skip smallint sqlca sqlcode union x xx xxx xxxx xxxxx xxxxxx z z9 zz zz9 zzz zzz9 zzzz zzzz9 zzzzz zzzzz9 zzzzzz zzzzzz9 zzzzzzz zzzzzzz9 zzzzzzzz zzzzzzzz9 zzzzzzzzz zzzzzzzzz9 zzzzzzzzzz zzzzzzzzzz9 zzzzzzzzzzz zzzzzzzzzzz9 zzzzzzzzzzzz zzzzzzzzzzzz9 zzzzzzzzzzzzz zzzzzzzzzzzzz9 zzzzzzzzzzzzzz zzzzzzzzzzzzzz9 zzzzzzzzzzzzzzz zzzzzzzzzzzzzzz9

Some are also found in them all, but not in your list: alter apply beginning binary-char binary-double binary-long binary-short bit boolean col communication contains controls crt dbcs declaratives default display-1 end-accept ending enter entry eop float-extended float-long float-short free function get invalid kanji limit limits linage linage-counter line line-counter lines options password ready reload renames return-code run segment-limit service skip1 skip2 skip3 stop trace unlock.

I don't know COBOL, but this seem kinda odd to me, especially some like renames that I encountered looking at the syntax.

@@ -16,7 +16,8 @@ quotedidentifier=identifier_2

[keywords]
# all items must be in one line
keywords=accept access add address advancing after alphabet alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited als alternate and any are area areas ascending assign at author before binary blank block bottom by cancel cbll cd cf ch character characters class clock-units close cobol code code-set collating column comma common communications computational compute configuration content continue control converting corr corresponding count currency data date date-compiled date-written day day-of-week de debug-contents debug-item debug-line debug-name debug-sub-1 debug-sub-2 debug-sub-3 debugging decimal-point delaratives delete delimited delimiter depending descending destination detail disable display divide division down duplicates dynamic egi else emi enable end-add end-compute end-delete end-divide end-evaluate end-if end-multiply end-of-page end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write environment equal error esi evaluate every exception extend external false fd file file-control filler final first footing for from generate giving global greater group heading high-value high-values i-o i-o-control identification in index indexed indicate initial initialize initiate input input-output inspect installation into is just justified key label last leading left length lock memory merge message mode modules move multiple multiply native negative next no not number numeric numeric-edited object-computer occurs of off omitted on open optional or order organization other output overflow packed-decimal padding page page-counter perform pf ph pic picture plus position positive printing procedure procedures procedd program program-id purge queue quotes random rd read receive record records redefines reel reference references relative release remainder removal replace replacing report reporting reports rerun reserve reset return returning reversed rewind rewrite rf rh right rounded same sd search section security segment segment-limited select send sentence separate sequence sequential set sign size sort sort-merge source source-computer special-names standard standard-1 standard-2 start status string sub-queue-1 sub-queue-2 sub-queue-3 subtract sum suppress symbolic sync synchronized table tallying tape terminal terminate test text than then through thru time times to top trailing true type unit unstring until up upon usage use using value values varying when with words working-storage write
primary=accept add advancing after alphabet also alternate and are ascending assign at author before bottom call cancel cbl cd cf ch class clock-units close cobol code code-set collating communications compute configuration continue control converting corr corresponding count currency data de declare debug-contents debug-item debug-line debug-name debug-sub-1 debug-sub-2 debug-sub-3 debugging delaratives delete delimited delimiter depending descending destination detail disable display divide division down duplicates egi eject else emi enable end end-add end-call end-compute end-delete end-divide end-evaluate end-exec end-if end-multiply end-of-page end-perform end-read end-receive end-return end-rewrite end-search end-start end-string end-subtract end-unstring end-write environment error esi evaluate every exception exec exit extend fd fetch file-control final first footing for from generate giving go goback group heading i-o i-o-control identification if indicate initial initialize initiate input-output insert inspect installation into is just justified last leading left linkage lock memory merge message move multiple multiply native negative next no not object-computer off on open optimize optional or order overflow padding perform pf ph pic picture plus position positive printing procedure proceed program program-id purge recording rd read receive redefines reel relative release remainder removal replace replacing report reporting reports rerun reserve reset return returning reversed rewind rewrite rf rh right rounded same sd search section security segment segment-limited select send sentence separate sequence sequential set sign skip sort sort-merge source source-computer special-names sql start string subtract sum suppress symbolic sync synchronized tallying tape terminal terminate test text then through thru to top trailing type union unit unstring until update upon usage use using varying when where with working-storage write
secondary=access address all alphabetic alphabetic-lower alphabetic-upper alphanumeric alphanumeric-edited any area areas argument-value asc binary blank block by char character characters column comma commarea common comp comp-0 comp-1 comp-2 comp-3 comp-4 comp-5 comp-6 comp-7 comp-8 comp-9 computational computational-0 computational-1 computational-2 computational-3 computational-4 computational-5 computational-6 computational-7 computational-8 computational-9 content copy current cursor date date-compiled date-written day day-of-week decimal decimal-point desc distinct dynamic environment-value equal external f false file filler global greater high-value high-values hold id in include index indexed input integer key length label less low-value low-values mode modules null nulls number numeric numeric-edited occurs of omitted only organization other output packed-decimal page page-counter pointer procedures queue quote quotes random record records reference references row rows s9 screen size smallint space spaces sqlca sqlcode standard standard-1 standard-2 status sub-queue-1 sub-queue-2 sub-queue-3 table than time times timestamp true up value values words x xx xxx xxxx xxxxx xxxxxx z z9 zz zz9 zzz zzz9 zzzz zzzz9 zzzzz zzzzz9 zzzzzz zzzzzz9 zzzzzzz zzzzzzz9 zzzzzzzz zzzzzzzz9 zzzzzzzzz zzzzzzzzz9 zzzzzzzzzz zzzzzzzzzz9 zzzzzzzzzzz zzzzzzzzzzz9 zzzzzzzzzzzz zzzzzzzzzzzz9 zzzzzzzzzzzzz zzzzzzzzzzzzz9 zzzzzzzzzzzzzz zzzzzzzzzzzzzz9 zzzzzzzzzzzzzzz zzzzzzzzzzzzzzz9 zero zeroes zeros
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x xx xxx xxxx xxxxx xxxxxx z z9 zz zz9 zzz zzz9 zzzz zzzz9 zzzzz zzzzz9 zzzzzz zzzzzz9 zzzzzzz zzzzzzz9 zzzzzzzz zzzzzzzz9 zzzzzzzzz zzzzzzzzz9 zzzzzzzzzz zzzzzzzzzz9 zzzzzzzzzzz zzzzzzzzzzz9 zzzzzzzzzzzz zzzzzzzzzzzz9 zzzzzzzzzzzzz zzzzzzzzzzzzz9 zzzzzzzzzzzzzz zzzzzzzzzzzzzz9 zzzzzzzzzzzzzzz zzzzzzzzzzzzzzz9

What is that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I started with cobol.vim by Tim Pope but main of the adds were by knowledge, use and experience.

Trust me, I didn't find a proper COBOL definition since a long time but every word I add is verified.

For exemple, RENAMES you could find this > http://www.techtricky.com/cobol-renames-clause-with-examples/ or by IBM > https://www.ibm.com/support/knowledgecenter/SSAE4W_9.1.0/com.ibm.etools.iseries.langref.doc/evfeb4ls37.htm

For DECLARATIVES (by IBM)> https://www.ibm.com/support/knowledgecenter/SSPSQF_9.0.0/com.ibm.etools.iseries.langref.doc/c0925395314.htm

x xx xxx xxxx xxxxx xxxxxx z z9 zz zz9 zzz zzz9 zzzz zzzz9 zzzzz zzzzz9 zzzzzz zzzzzz9 zzzzzzz zzzzzzz9 zzzzzzzz zzzzzzzz9 zzzzzzzzz zzzzzzzzz9 zzzzzzzzzz zzzzzzzzzz9 zzzzzzzzzzz zzzzzzzzzzz9 zzzzzzzzzzzz zzzzzzzzzzzz9 zzzzzzzzzzzzz zzzzzzzzzzzzz9 zzzzzzzzzzzzzz zzzzzzzzzzzzzz9 zzzzzzzzzzzzzzz zzzzzzzzzzzzzzz9

Above it is for the declaration of variables in characters or numeric. The 'x' ones are for some characters declarations and 'z' ones for numbers. I know that these types of statements may seem strange but I have not found other ways to translate them and here all cases are covered

For example you could have 05 WS-EXCEEDS-PTS-P PIC ZZZZZZZZ9.99 VALUE ZEROS.
Or 05 W-SIT-ISC-IMS-SSID PIC XXXX.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't the zzzzzzzzzzzzzzzz things formatting, not keywords?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't the zzzzzzzzzzzzzzzz things formatting, not keywords?

It's PIC clause, it's slightly different ;')

PS : For COMPUTATIONAL (still by IBM) > https://www.ibm.com/support/knowledgecenter/fr/SSKPEG_9.5.0/com.ibm.pdp.pac.doc/topics/rsegment_ce_fillerdef.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link points to something about an unintelligible language (Cobol) in an unintelligible language (French) so its no help.

PIC effectively is the record format, but however you want to look at it, the point is its not a keyword.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link points to something about an unintelligible language (Cobol) in an unintelligible language (French) so its no help.

My bad, I think I put an english link but I wrongly connect with my account before to copy, here the good one > https://www.ibm.com/support/knowledgecenter/en/SSKPEG_9.5.0/com.ibm.pdp.pac.doc/topics/rsegment_ce_fillerdef.html

PIC effectively is the record format, but however you want to look at it, the point is its not a keyword.

Yes certainly, it's just more readable like this but you are master on that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I have to erase them from filedef ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For exemple, RENAMES you could find this > http://www.techtricky.com/cobol-renames-clause-with-examples/ or by IBM > https://www.ibm.com/support/knowledgecenter/SSAE4W_9.1.0/com.ibm.etools.iseries.langref.doc/evfeb4ls37.htm

My point is that your version does not have RENAMES, which I found odd. It's the same with the other ones I listed in the same bunch: they appear in the three sources I found, but not in your list.

PS : For COMPUTATIONAL (still by IBM) > https://www.ibm.com/support/knowledgecenter/fr/SSKPEG_9.5.0/com.ibm.pdp.pac.doc/topics/rsegment_ce_fillerdef.html

I've seen COMPUTATIONAL up to 6, but your link lists 7 and 9, so OK.

Do I have to erase them from filedef ?

I don't have a strong opinion as I don't know COBOL, but I'd rather separate this. Maybe put it in extended_keywords so it's at least in a different list?

BTW, how did you split secondary and primary? Just curious.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that your version does not have RENAMES, which I found odd. It's the same with the other ones I listed in the same bunch: they appear in the three sources I found, but not in your list.

It's true. I mainly add the reserved words I see often and those of the Tim Pope's list as I said. If you're OK I'll have a look within a few days and let you know.

I don't have a strong opinion as I don't know COBOL, but I'd rather separate this. Maybe put it in extended_keywords so it's at least in a different list?

OK I'll also test it and let you know. Agree ?

BTW, how did you split secondary and primary? Just curious.

I simply tried to get as close as possible to what you could find on the IBM editor and made some adaptations for more readability

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, sounds great :)

data/filedefs/filetypes.cobol Outdated Show resolved Hide resolved
Correcting DECLARATIVES keyword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants