COBOL grammar and literary law (2)

xiaoxiao2021-03-06  46

Accept data from the keyboard or other input device. Accept A from dev. Read data from DEV to A, or omitting from dev, represents from the keyboard. Accept a from date / day / day-of-week / time. The date is expressed as 6 characters, such as 990909 (September 9, 1999). Read the current date in the year (first 2) for the first few days (after 3), it is expressed as 6 characters, as shown on April 1, 1994. Read the current week, indicated as 1 character. 1 means Monday, 7 means Sunday. Read the current time, indicating as an 8-bit character. Accurate to milliseconds. As is 14410000, as shown at 2:41 pm.

Display writes data to the output device. Such as monite, system output stream, and operator console. Display AAAA BBBB [UPON DEV] [with no advancing] If you use the UPON option, DEV is to be associated with the hardware name in the Special-Names segment. If you use the No Advancing option, the output device remains in place after the last character is output, so that the next Display statement is still displayed in this location. Otherwise it may be displayed next to the next line.

Initialize initialized data, numbers and digital editing data items are initialized to 0, and other initialization is spaced.

The number of times the string appears in the inspect tallying calculation project. Inspect aa tallying bb for all "ee". How many EE is found from the AA, write a number to BB. Inspect AA Tallying BB for Characters Before "E". How many characters are found from the front of the E E, write a number to BB. Inspect aa tallying bb for character "c" before "e". How many characters have to be found in front of the decs in the AA, write a number to BB. Inspect aa tallying bb for letting "e". How many E is found from the first character in the AA, if not ending the operation, there is no number to BB until no. Inspect aa tallying bb for letting "e" after "c". How many E is found from the AA C. If there is no operation, it will write a bit to BB until there is no. Combination example: 77 CS Pic x (9) Value "reelwheel". 77 count-0. 77 count-1. 77 count-2. Move 0 to count-0, count-1, count-2. Inspect cs tallying count- 0 for ALL "E", count-1 for letting "w" after "l", count-2 for character, the program first judges the character "R", execute count-0 for all "e" because the first The characters are not "e", so the program turns to perform count-1 for letting "w" after "L", and does not meet the requirements, so the program performs count-2 for character, count-2 = 1. Then string to the next bit, determine "e", execute count-0 for all "e", meet the requirements, then count-0 = 1. With the judgment of satisfying the conditions, the rest of the judgment is no longer executed, the string is again down, and "E" is determined, then count-0 = 2. Then, "L" is then determined, then count-2 = 2. With this, the final result is count-0 = 4, count-1 = 1, count-2 = 4. Inspect replan replaces this string with another string. Also use the above example.

Inspect CS Replacing All "E" by "y". Result "Ryylwhyyl" Inspect CS Replacing Characters by "z" after "L". Result "ReelZzz" Inspect CS Replacing Leading "E" by "y". Result constant Inspect CS Replacing Leading "E" by "z" after "h". Result "Reelwhzzl" Inspect CS Replacing First "e" by "I". Result "Rieelwheel" Inspect CS Replacing First "EE" by "00", All "WH" BY "TH", Characters by space. Result "00 th" Inspect Converting is an abbreviation for inspect replacing. Inspect CS Converting "EE" to "00". You can also add Before, After. String combines several strings into a string. String a Delimited by Space, "!" Delimited by size Into C. Suppose the contents A is "Hello", the result is "Hello!". DELIMITED by Space meaning to touch spaces, or at the end of A or C At the end, the merge A string ends. Delimited by size means the end of the end of "!" Or C, the incoming "!" String ends. String a INTO B POINTER C ON overflow proc1 NOT ON overflow proc2. Copy the A string to the address starting from C. If C is less than 1 or greater than the length of B, or the length of A is greater than the length of c to the tail in B, OVERFLOW overflow occurs, and proC1 is executed.

Unstring puts the characters in a string as required in multiple variables. Unstring aaa [Delimited by [all] b [or [all] c] ... {c [delimiter in d] [count in e]} ... [with pointer f] [Tallying in g] [on overflow Proc1] [NOT ON OVERFLOW PROC2] [end-unstring] puts the characters in the AAA into C, if there are other variables, such as C2, then add C2 after the C2 is filled. Delimited By and String the role. Referring to the character from the AAA to B. If there is OR, it is denoted by the characters from B or C characters. If there is all, if several identical b are together, it is considered to be a B. Delimiter IN puts B in D, know which character is separator. Count in actually copies the number of characters in C in E. WITH POINTER and STRIGN. Tallying in computing has several acceptings. Access a new accept term, G value plus 1. Example: 03 City Pic X (10). O3 ZIP PIC X (10). 77 Test Pic X (20). Move "New York, NY 10017" To Test. Unstring Test Delimited by "," INTO City, ZIP. Execution The value of the current value is the value of New York.zip is NY 10017. Logic and control statement IF (a [not]> b) equivalent to IF (a [not] Greater Than B) IF (A [Not] = b) equivalent to IF (a Greater Than or Equal TO B) IF (a <= b) equivalent IF (a Less Than Or Equal to B)

IF (a [not]> b and c) represents A [NOT] greater than B and A [NOT] greater than c if a is [not] numeric number and optional symbol IF a is [not] alphabetic a ~ z, a ~ Z Character and Space IF A IS [NOT] Alphabetic-Lower A ~ Z Character and Space IF A IS [NOT] Alphabetic-Upper A ~ Z Character and Space IF A IS [NOT] Class-Name Special-Names defined character set For example: Special-names. Class MyDefine IS "12345 ABCDE-".

The determination variable defines a value. This variable is 88 layers and is associated with a data item. 03 State Pic XX. 88 CON VALUES ARE "A", "B", "C". Ifcon ...

Judging the manufacturer defines the on / off state of the running switch. SPECIAL-NAMES. Switch-a on status is a-on, off status is a-OFF. If A-ON ... If the switch is open, IF A-ON returns True.

If a is [not] Positive determines if it is greater than 0 if a is [not] negative judgment is less than 0 if a is [not] ZERO determines if 0COBOL supports NOT, AND, OR operation.

Perform process call, but does not pass parameters. Perform proc1 [through proc2] Performed proc1 and executed Proc2. No through (thru) only executes proc1. Perform proc1 [thru proc2] n Times Execute Proc1 [or PROC2] N times. Perform proc1 [thru proc2] [with test before / after] Until a not euqal 0. Execute PROC1 [or also with proc2] until A is not equal to 0. WITH TEST BEFORE / AFTER Specifies that the conditions before or after the first execution. The default is Before, it is executed before execution. Perform proc1 [thru proc2] [with test before / after] Varying a from b by c until condition1 [after D from e by f Until condition2]. Equivalent to the FOR cycle, start from B, incremented by C Until Condition1. The AFTER statement is a nested for loop. Varying is a foreign cycle, and after the AFTER is an internal cycle. A, B can be an index.

The process can also be written directly into Perform. But Through is not easy to use. The syntax is as follows: Perform Process Statement End-Perform. Perform N Times Procedure Statement End-Perform. Perform [with Test Before / After] Until Condition Process Statement End-Perform. Perform [with test before / after] Varying a from b by c uncle CONDITION1 Process Statement End-Perform.

The if statement if condition thrse statements2 end-if / next sentence / Endif next SENTENCE will jump out of the IF operation statement to perform the next statement. Do not use in the IF statement. The end will end all if statements. To end a nested IF statement, you can use end-if or next senence. Such as if a if b end-if else c end-if. Or if a if b else next sentence else c end-if.

Evaluate is equivalent to the Switch Case statement. Evaluate A WHEN B ... WHEN 0 thru 100 ... (from 0 to 100) When Other ... [end-evata] First get the result of A, compare the parameters of the WHEN statement, if you are equal, The operation after B is completed, and the WHEN statement that is no longer executed. If you don't wait, you will perform the next WHEN statement. Execute the WHEN Other statement if it is not equal. Evaluate a Also B WHEN C Also D ... WHEN E Also f ... WHEN Other ... For multiple judgment conditions, multiple conditions are met. The WHEN statement is executed simultaneously if you want c = A above.

Continue continues to perform the following program.

Go to Go To Proc1 [Depending ON N] Depending ON N will jump to the nth proc.exit in the list is generally the last sentence.

STOP STOP RUN End Procedure.

Alter alter proc1 to proc2. Don't know what it means, anyway, this statement has been abolished from the standard.

ENTER enables statements in other programming languages ​​to place them in the current source program. Enter language-name [routine-name] Language is a manufacturer specified any language that can be entered into COBOL, which is the statement of other programming languages, and then use Entercobol to return to the COBOL language. If you cannot put them directly in other languages, you can use the Routine-name to reference the program written in other languages.

转载请注明原文地址:https://www.9cbs.com/read-80405.html

New Post(0)