![]() ![]() 0* Redefines means that this 01 level item occupies the same spot in memory as the one it redefines so actually the two 01 levels are the same thing with different names and different picture 01 MONTH-TABLE REDEFINES MONTH-TABLE-LITERALS. 05 FILLER PIC X(11) VALUE ‘09SEPTEMBER’ 05 FILLER PIC X(11) VALUE ‘10OCTOBER’. most explanations are meaningless, until you study this carefully to see what is happening these are fillers, because you won’t be referring to them directly, by name notice how the code (01) is written right beside the name (january) all the pictures must be the same the literals inside of quotes don’t have to be the same length, but many will code them that way 05 FILLER PIC X(11) VALUE ‘01JANUARY’. 05 DL-RECORD-IMAGE PIC X(80) VALUE SPACES. 05 FILLER PIC X(35) VALUE ‘EMPLOYEE RECORDS WITH MONTH OF HIRE’. 05 CTR-RECORDS-WRITTEN PIC 9(5) PACKED-DECIMAL VALUE 0. 05 CTR-RECORDS-READ PIC 9(5) PACKED-DECIMAL VALUE 0. 0 FD REPORT-FILE RECORDING MODE IS F RECORD CONTAINS 133 CHARACTERS. MONTH OF HIRE CAN BE DEFINED AS CHARACTER (ALPHANUMERIC) 05 ER-MONTH-OF-HIRE PIC X(02). INPUT RECORD DESCRIPTION 05 FILLER PIC X(08). FD INPUT-FILE RECORDING MODE IS F RECORD CONTAINS 80 CHARACTERS. REPORTFI: A REPORT FILE, PRINTS OUT INFORMATION ON EMPLOYEES WITH MONTH OF HIRE, SEND TO PRINTER SELECT REPORT-FILE ASSIGN REPORTFI. INPUT FILE EMP SELECT INPUT-FILE ASSIGN EMP. The binary search reads every input record after looking up the employee’s month of hire on a table, by a sequential search, it writes it out to an output file ENVIRONMENT DIVISION. Searching for a value in a Table: R: which(sapply(df, function(x) any(month = "January"))) Python: df COBOL: IDENTIFICATION DIVISION. MOVE '12ABCDEF34GHIJKL56MNOPQR' TO WS-TABLE. ![]() Working with tables of data: R: x Python: x.iloc COBOL: IDENTIFICATION DIVISION. ![]() PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I > 6 DISPLAY WS-TBL(WS-I) END-PERFORM. DISPLAY ‘>DESCENDING ORDER 6 IF WS-FLD(WS-J) > WS-FLD(WS-I) THEN MOVE WS-TBL(WS-I) TO WS-TAB-HLD MOVE WS-TBL(WS-J) TO WS-TBL(WS-I) MOVE WS-TAB-HLD TO WS-TBL(WS-J) END-IF END-PERFORM END-PERFORM. DISPLAY ‘>ASCENDING ORDER 6 IF WS-FLD(WS-J) 6 DISPLAY WS-TBL(WS-I) END-PERFORM. ![]() We put the hottest languages to the test! Sorting an Array R: sort(x) Python: numpy.sort(x) COBOL: IDENTIFICATION DIVISION. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |