any questions?
DESCRIPTION
Any Questions?. Agenda. Moving Data Selection Statements System Date Indicators in Display files. Moving Data. Move Statement. MOVE Identifier/Variable or Literal/Constant TO (Indentifier/Variable)s. Numeric Moves. Sending FieldReceiving Field Okay? NumericNumeric Field sizes - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/1.jpg)
Any Questions?
![Page 2: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/2.jpg)
Agenda
• Moving Data
• Selection Statements
• System Date
• Indicators in Display files
![Page 3: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/3.jpg)
Moving Data
![Page 4: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/4.jpg)
Move Statement
MOVE Identifier/Variable or Literal/Constant
TO (Indentifier/Variable)s
![Page 5: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/5.jpg)
Numeric Moves
Sending Field Receiving Field Okay?Numeric Numeric
– Field sizes
Numeric Alphanumeric– Decimal places– Packed fields
Numeric Group Item
![Page 6: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/6.jpg)
Alphanumeric Moves
Sending Field Receiving Field Okay?Alphanumeric Numeric
– Decimal Places– Packed fields
Alphanumeric Alphanumeric– Field sizes
Alphanumeric Group Item
![Page 7: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/7.jpg)
Zero Moves
Sending Field Receiving Field Okay?
Zeros Numeric
Zeros Alphanumerics
Zeros Group Item
![Page 8: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/8.jpg)
Spaces Moves
Sending Field Receiving Field Okay?
Spaces Numeric
Spaces Alphanumerics
Spaces Group Items
![Page 9: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/9.jpg)
MOVE numeric TO numeric.
Field A PIC 9(3) Field B PIC 9(3)
100
Field A PIC 9(3) Field B PIC 9(4)
100
Field APIC 9(3) Field B PIC 9(2)
100
![Page 10: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/10.jpg)
MOVE numeric TO numeric.
Field A PIC 9(3)V99 Field B PIC 99V9
100.03
Field A PIC 9(3)V99 Field B PIC 9(4)V999
100.03
Field A PIC 9(3)V99 Field B PIC 9(3)
100.03
![Page 11: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/11.jpg)
MOVE numeric TO alphanumeric.
Field A PIC 9(3) Field B PIC X(3)
100
Field A PIC 9(3) Field B PIC X(4)
100
Field A PIC 9(3) Field B PIC X(2)
100
![Page 12: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/12.jpg)
MOVE numeric TO alphanumeric.
Field A PIC 9(3)V99 Field B PIC X(3)
100.03
![Page 13: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/13.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC 99.
Field D PIC 9.
Field AField B Field C Field D
124
![Page 14: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/14.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC 99.
Field D PIC 99.
Field AField B Field C Field D
124
![Page 15: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/15.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC 9.
Field D PIC 9.
Field AField B Field C Field D
124
![Page 16: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/16.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC XX.
Field D PIC X.
Field AField B Field C Field D
124
![Page 17: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/17.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC XX.
Field D PIC XX.
Field AField B Field C Field D
124
![Page 18: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/18.jpg)
MOVE numeric TO group item
Field A PIC 9(3) Field B.
Field C PIC X.
Field D PIC X.
Field AField B Field C Field D
124
![Page 19: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/19.jpg)
MOVE alphanum TO alphanum.
Field APIC X(3) Field B PIC X(3)
CJM
Field A PIC X(3) Field B PIC X(4)
CJM
Field APIC X(3) Field B PIC X(2)
CJM
![Page 20: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/20.jpg)
MOVE alphanum TO group item
Field A PIC X(3) Field B.
Field C PIC XX.
Field D PIC X.
Field AField B Field C Field D
CJM
![Page 21: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/21.jpg)
MOVE alphanum TO group item
Field A PIC X(3) Field B.
Field C PIC XX.
Field D PIC XX.
Field AField B Field C Field D
CJM
![Page 22: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/22.jpg)
MOVE alphanum TO group item
Field A PIC X(3) Field B.
Field C PIC X.
Field D PIC X.
Field AField B Field C Field D
CJM
![Page 23: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/23.jpg)
MOVE alphanum TO numeric.
Field APIC X(3) Field B PIC 9(3)
ABC
![Page 24: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/24.jpg)
MOVE zeros TO numeric.
Field B PIC 9(3)
Field BPIC 9(4)V99
![Page 25: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/25.jpg)
MOVE zeros TO alphanumeric.
Field B PIC X(3)
Field BPIC X(1)
![Page 26: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/26.jpg)
MOVE zero TO group item
Field B.
Field C PIC 99.
Field D PIC 9.
Field BField C Field D
![Page 27: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/27.jpg)
MOVE zeros TO group item
Field B.
Field C PIC XX.
Field D PIC XX.
Field BField C Field D
![Page 28: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/28.jpg)
MOVE spaces TO numeric.
Field B PIC 9(3)
Field BPIC 9(4)V99
Note: This is not supposed to work!
![Page 29: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/29.jpg)
MOVE spaces TO alphanumeric.
Field B PIC X(3)
Field BPIC X(1)
![Page 30: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/30.jpg)
MOVE spaces TO group item
Field B.
Field C PIC 99.
Field D PIC 9.
Field BField C Field D
Note: this is not supposed to work!
![Page 31: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/31.jpg)
MOVE spaces TO group item
Field B.
Field C PIC XX.
Field D PIC XX.
Field BField C Field D
![Page 32: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/32.jpg)
On your own, figure out how Group Item to Group Item and Group Item to Alphanumeric
work!
![Page 33: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/33.jpg)
Selection Statements
![Page 34: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/34.jpg)
Sorting on the iSeriesEBCDIC Sort
1. Blanks
2. Special Characters
3. Lower Case Letters
4. Upper Case Letters
5. Numbers
![Page 35: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/35.jpg)
Selection
Condition?
Statement2 Statement1
![Page 36: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/36.jpg)
Selection
IF Condition THEN
Statement(s)
ELSE
Statement(s)
END-IF
![Page 37: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/37.jpg)
If-Then-ElseA = 10 B = 20
If (A > B) THENMOVE B TO A.
![Page 38: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/38.jpg)
If-Then-ElseA = 10 B = 20
If A > B THENMOVE B TO A
ELSEMOVE A TO B.
![Page 39: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/39.jpg)
If-Then-ElseA = 10 B = 20 C = 30 D = 40
If A < B THENIF A > C THEN
MOVE A TO CELSE
MOVE C TO AEND-IF
ELSEMOVE A TO B
END-IF.
![Page 40: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/40.jpg)
Sign Test
A = 10 B = -10
If A IS NEGATIVE IF A IS POSITIVE
MOVE B TO A MOVE B TO A
ELSE ELSE
MOVE A TO B. MOVE A TO B.
![Page 41: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/41.jpg)
Numeric Test
A = 10 B = -10
If A IS NUMERIC
ADD A TO B.
![Page 42: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/42.jpg)
Alphabetic Test
C = ‘CJ’ D = ‘Christy’
If C is ALPHABETIC THEN
MOVE C TO OLDER-SISTER
ELSE
MOVE D TO OLDER-SISTER
END-IF
![Page 43: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/43.jpg)
Alphabetic-Upper Test
C = ‘CJ’ D = ‘Christy’
If C is ALPHABETIC-UPPER THEN
MOVE C TO OLDER-SISTER
ELSE
MOVE D TO OLDER-SISTER
END-IF
![Page 44: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/44.jpg)
Alphabetic-Lower Test
C = ‘CJ’ D = ‘Christy’
If D is ALPHABETIC-LOWER THEN
MOVE D TO OLDER-SISTER
ELSE
MOVE C TO OLDER-SISTER
END-IF
![Page 45: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/45.jpg)
AND
FIELDA FIELDB Result
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE
![Page 46: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/46.jpg)
OR
FIELDA FIELDB Result
TRUE TRUE TRUE
TRUE FALSE TRUE
FALSE TRUE TRUE
FALSE FALSE FALSE
![Page 47: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/47.jpg)
AND/OR Order of Operations
• Brackets First
• ANDs (From Left to Right)
• ORs (From Left to Right)
![Page 48: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/48.jpg)
ANDs/ORs
A = 10 B = -10 C = 20
If (A<B) OR (B<C) AND (A<C) THEN
MOVE A TO C
ELSE
MOVE A TO B
END-IF
![Page 49: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/49.jpg)
ANDs/ORs
A = 10 B = -10 C = 20
If ((A<B) OR (B<C)) AND (A<C) THEN
MOVE A TO C
ELSE
MOVE A TO B
END-IF
![Page 50: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/50.jpg)
Case Statements
![Page 51: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/51.jpg)
IF-THEN-ELSE StatementsIF MARKS >= 80 THEN
MOVE ‘A’ TO GRADE
ELSE
IF MARKS >= 70 THEN
MOVE ‘B’ TO GRADE
ELSE
IF MARKS >= 60 THEN
MOVE ‘C’ TO GRADE
ELSE
IF MARKS >= 55 THEN
MOVE ‘D’ TO GRADE
ELSE
MOVE ‘F’ TO GRADE
END-IF
END-IF
END-IF
ENDIF.
![Page 52: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/52.jpg)
CASE StatementsEVALUATE TRUE
WHEN MARKS >= 80 MOVE ‘A’ TO GRADE
WHEN MARKS >= 70 AND MARKS < 80 MOVE ‘B’ TO GRADE
WHEN MARKS >= 60 AND MARKS < 70 MOVE ‘C’ TO GRADE
WHEN MARKS >= 55 AND MARKS < 60 MOVE ‘D’ TO GRADE
WHEN OTHER MOVE ‘F’ TO GRADE
END-EVALUATE.
![Page 53: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/53.jpg)
CASE StatementsEVALUATE GRADE
WHEN ‘A’ DISPLAY ‘WONDERFUL!!!!’
WHEN ‘B’ DISPLAY ‘GREAT!!!’
WHEN ‘C’ DISPLAY ‘NEED ANY HELP?’
WHEN ‘D’ DISPLAY ‘COME AND SEE ME!’
WHEN ‘F’ DISPLAY ‘SEE YOU NEXT SEMESTER’
WHEN OTHER DISPLAY ‘WE HAVE A PROBLEM!’
END-EVALUATE.
![Page 54: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/54.jpg)
Problem
ANNAME is a 20 character field in the file, ANMPF that stores an animal name.
ANMPF is a Physical file that contains a record for each of animals clients at the Seneca Vet Clinic.
You are required to write a COBOL program that selects all of the animals listed in ANMPF that start with a C.
What COBOL statement would select all of the animals names that start with the letter ‘C’.
![Page 55: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/55.jpg)
System Date
• Function current-date
• Function convert-date-time
![Page 56: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/56.jpg)
Indicators in Display Files
![Page 57: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/57.jpg)
Option Indicators in COBOL
• Binary Values• Working Storage Definition example 01 ws-indicator-list.
05 IN88 INDICATOR 88 PIC 1 value B’0’.
• Passed to display files in the write statementWrite Display-record
format is ‘RECORD1’indicators are ws-indicator-list.
![Page 58: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/58.jpg)
Example – Indicator 90 displays the message, Employee Name is invalid
Working Storage.01 ws-indicators.
05 IN90 INDICATOR 90 pic 1.
Procedure Division.
If scr-employee-name is equal to spaces move b’1’ to IN90 else
move b’0’ to IN90 end-if.
![Page 59: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/59.jpg)
Response Indicators in COBOL
• Stored as binary values in the display file and passed as PIC X(2) via the control Area.
Select Display-file assign to workstation-dspfile-si organization is transaction control area is ws-control.Working Storage Section.01 ws-control. 05 ws-function-key pic x(2).
![Page 60: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/60.jpg)
Example – check to see if function key 3 was pressed.
Select Display-file assign to workstation-dspfile-si organization is transaction control area is ws-control.Working Storage Section.01 ws-control. 05 ws-function-key pic x(2).
Procedure Division.
if ws-function-key = ’03’ ….. end-if.
![Page 61: Any Questions?](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813cad550346895da65805/html5/thumbnails/61.jpg)
Display file ‘Both’ Fields
• Input and Output buffers
• REDEFINES clause– Different data specifications for same memory
location
• Screens with both fields need an input and an output buffer.