SlideShare a Scribd company logo
UNSTRING
UNSTRING Syntax. UNSTRING FullName DELIMITED BY ALL SPACES    INTO FirstName, SecondName, Surname END-UNSTRING UNSTRING CustAddress DELIMITED BY ","   INTO AdrLine(1), AdrLine(2), AdrLine(3),   AdrLine(4), AdrLine(5), AdrLine(6)    TALLYING IN AdrLinesUsed END-UNSTRING.
How the UNSTRING works The UNSTRING copies characters from the  Source String  to the  Destination String  until a  Delimiter  is encountered in the  Source String   or  the  Destination String  is full. When either of these things happen the next  Destination String  becomes the receiving area and characters are copied into it until it too is full or another  Delimiter  is encountered in the  Source String . Characters are copied from the  Source String  to the  Destination Strings  according to the rules for Alphanumeric moves.  There  is  space filling.
UNSTRING Termination The UNSTRING statement terminates when:- All the characters in the  Source String  have been  examined OR All the  Destination Strings  have been  processed OR  Some  error  condition is  encountered .
UNSTRING clauses. ON OVERFLOW. The  ON OVERFLOW  is activated if :- The Unstring pointer (Pointer#i) is  not   pointing  to a character position  within  the  SourceString  when the  UNSTRING  executes. All the Destination Strings have been processed but there are still valid  unexamined characters in the Source String . COUNT IN  The  COUNT IN  clause is associated with a particular Destination String and holds a  count  of the number of  characters  passed to the Destination String. TALLYING IN Only one  TALLYING  clause can be used with each  UNSTRING .  It holds a  count  of the number of  Destination Strings  affected by the  UNSTRING  operation.
The UNSTRING clauses 2. WITH POINTER The  Pointer#i  holds the  position  of the next non-delimiter character to be  examined  in the  Source String . Pointer#i  must be  large enough  to hold a value  one greater  than the size of the  Source String . DELIMITER IN A  DELIMITER IN  clause is associated with a particular Destination String.  HoldDelim$i  holds the  Delimiter  that was  encountered  in the  Source String . ALL When the A LL  phrase is used,  contiguous delimiters  are treated as if only  one delimiter  had been encountered.
UNSTRING Example 1 01 DayStr  PIC XX.   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr   INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 1 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9  - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr   INTO DayStr , MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 1 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. - 0 01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9  - 0  5 - 8 0 ACCEPT DateStr. UNSTRING DateStr   INTO DayStr, MonthStr,  YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 1 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. - 0 01 YearStr  PIC XX. 5 - 01 DateStr  PIC X(8). 1 9 - 0  5 -  8 0 ACCEPT DateStr. UNSTRING DateStr   INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 1 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. - 0 01 YearStr  PIC XX. 5 - 01 DateStr  PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr   INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING. Chars Left
UNSTRING Example 2 01 DayStr  PIC XX.   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(14). 1 9 s t o p 0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop"   INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 2 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(14). 1 9   s t o p  0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop"   INTO DayStr,  MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 2 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5 01 YearStr  PIC XX.   01 DateStr  PIC X(14). 1 9 s t o p  0 5   s t o p  8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop"   INTO DayStr, MonthStr,  YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 2 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5 01 YearStr  PIC XX. 8 0 01 DateStr  PIC X(14). 1 9 s t o p 0 5 s t o p  8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop"   INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 3 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9   -  0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
UNSTRING Example 3 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5   01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9 -  0 5   /  8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
UNSTRING Example 3 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5   01 YearStr  PIC XX. 8 0 01 DateStr  PIC X(8). 1 9 - 0 5 /  8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
UNSTRING Example 3 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5   01 YearStr  PIC XX. 8 0 01 DateStr  PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2 19 05 80 - /
UNSTRING Example 4 01 DayStr  PIC XX.   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold1 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1
UNSTRING Example 4 01 DayStr  PIC XX. 1 9   01 MonthStr PIC XX. 0 5   01 YearStr  PIC XX. 8 0 01 DateStr  PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY "/" OR "-"   INTO DayStr  DELIMITER IN Hold1 MonthStr DELIMITER IN Hold1 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 19 05 80 /
UNSTRING Example 5 01 DayStr  PIC XX.   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY  ALL "-"   INTO DayStr, MonthStr, YearStr   ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 5 01 DayStr  PIC XX. 1 5   01 MonthStr PIC XX. 0 7   01 YearStr  PIC XX. 9 4 01 DateStr  PIC X(11). 1 5   - - -   0 7   - -   9 4 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY  ALL "-"   INTO DayStr, MonthStr, YearStr   ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 6 01 DayStr  PIC XX.   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY  "-"   INTO DayStr, MonthStr, YearStr   ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
UNSTRING Example 6 01 DayStr  PIC XX. 1 5   01 MonthStr PIC XX.   01 YearStr  PIC XX.   01 DateStr  PIC X(11). 1 5   - -  - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr   DELIMITED BY  "-"   INTO DayStr, MonthStr, YearStr   ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING. Chars Left
UNSTRING Example 7 01 OldName  PIC X(80). 01 TempName. 02 NameInitial  PIC X. 02 FILLER  PIC X(15). 01 NewName  PIC X(30). 01 Pointers. 02 StrPtr  PIC 99 VALUE 1. 02 UnstrPtr  PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   Display TempName END-PERFORM STOP RUN. Tim  John  Roberts
UNSTRING Example 7 01 OldName  PIC X(80). 01 TempName. 02 NameInitial  PIC X. 02 FILLER  PIC X(15). 01 NewName  PIC X(30). 01 Pointers. 02 StrPtr  PIC 99 VALUE 1. 02 UnstrPtr  PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   Display TempName END-PERFORM STOP RUN. Tim Tim   John  Roberts T im
UNSTRING Example 7 01 OldName  PIC X(80). 01 TempName. 02 NameInitial  PIC X. 02 FILLER  PIC X(15). 01 NewName  PIC X(30). 01 Pointers. 02 StrPtr  PIC 99 VALUE 1. 02 UnstrPtr  PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   Display TempName END-PERFORM STOP RUN. John Tim  John   Roberts J ohn
UNSTRING Example 7 01 OldName  PIC X(80). 01 TempName. 02 NameInitial  PIC X. 02 FILLER  PIC X(15). 01 NewName  PIC X(30). 01 Pointers. 02 StrPtr  PIC 99 VALUE 1. 02 UnstrPtr  PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   Display TempName END-PERFORM STOP RUN. Roberts Tim  John  Roberts R oberts
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts T im
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts T  im T .
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts J ohn T .
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts J  ohn T .  J .
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts R oberts T . J .
UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr   END-UNSTRING   END-PERFORM STRING SPACE TempName DELIMITED BY SIZE  INTO NewName WITH POINTER StrPtr   END-STRING STOP RUN. Tim  John  Roberts R oberts T . J .  Roberts

More Related Content

PPT
PDF
modelo de un presupuesto
PDF
Cobol Error Its states that my patron-line wasnt defined as a data .pdf
DOCX
As400 load all subfile
PDF
Biddeford_7.28.15
DOCX
COBOL DB2 BATCH EXAMPLE-RPR6520
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
modelo de un presupuesto
Cobol Error Its states that my patron-line wasnt defined as a data .pdf
As400 load all subfile
Biddeford_7.28.15
COBOL DB2 BATCH EXAMPLE-RPR6520
PptxGenJS_Demo_Chart_20250317130215833.pptx

Recently uploaded (20)

PDF
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
PDF
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
PDF
What is Rotoscoping Best Software for Rotoscoping in 2025.pdf
PDF
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
PDF
oppenheimer and the story of the atomic bomb
PPTX
continuous_steps_relay.pptx. Another activity
PPTX
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
DOCX
Talking Owls and Time Travel: Lessons in Curiosity
PDF
High-Quality PDF Backlinking for Better Rankings
PPTX
Other Dance Forms - G10 MAPEH Reporting.pptx
PPTX
The Pearl - project of Advanced Reading course
PPTX
just letters randomized coz i need to up
PDF
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
DOCX
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
PDF
How Old Radio Shows in the 1940s and 1950s Helped Ella Fitzgerald Grow.pdf
DOCX
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
PPTX
the Honda_ASIMO_Presentation_Updated.pptx
PDF
Western Pop Music: From Classics to Chart-Toppers
DOCX
Elisabeth de Pot, the Witch of Flanders .
PPTX
understanding the Human DNA components database design
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
What is Rotoscoping Best Software for Rotoscoping in 2025.pdf
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
oppenheimer and the story of the atomic bomb
continuous_steps_relay.pptx. Another activity
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
Talking Owls and Time Travel: Lessons in Curiosity
High-Quality PDF Backlinking for Better Rankings
Other Dance Forms - G10 MAPEH Reporting.pptx
The Pearl - project of Advanced Reading course
just letters randomized coz i need to up
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
How Old Radio Shows in the 1940s and 1950s Helped Ella Fitzgerald Grow.pdf
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
the Honda_ASIMO_Presentation_Updated.pptx
Western Pop Music: From Classics to Chart-Toppers
Elisabeth de Pot, the Witch of Flanders .
understanding the Human DNA components database design
Ad
Ad

Unstring

  • 2. UNSTRING Syntax. UNSTRING FullName DELIMITED BY ALL SPACES INTO FirstName, SecondName, Surname END-UNSTRING UNSTRING CustAddress DELIMITED BY "," INTO AdrLine(1), AdrLine(2), AdrLine(3), AdrLine(4), AdrLine(5), AdrLine(6) TALLYING IN AdrLinesUsed END-UNSTRING.
  • 3. How the UNSTRING works The UNSTRING copies characters from the Source String to the Destination String until a Delimiter is encountered in the Source String or the Destination String is full. When either of these things happen the next Destination String becomes the receiving area and characters are copied into it until it too is full or another Delimiter is encountered in the Source String . Characters are copied from the Source String to the Destination Strings according to the rules for Alphanumeric moves. There is space filling.
  • 4. UNSTRING Termination The UNSTRING statement terminates when:- All the characters in the Source String have been examined OR All the Destination Strings have been processed OR Some error condition is encountered .
  • 5. UNSTRING clauses. ON OVERFLOW. The ON OVERFLOW is activated if :- The Unstring pointer (Pointer#i) is not pointing to a character position within the SourceString when the UNSTRING executes. All the Destination Strings have been processed but there are still valid unexamined characters in the Source String . COUNT IN The COUNT IN clause is associated with a particular Destination String and holds a count of the number of characters passed to the Destination String. TALLYING IN Only one TALLYING clause can be used with each UNSTRING . It holds a count of the number of Destination Strings affected by the UNSTRING operation.
  • 6. The UNSTRING clauses 2. WITH POINTER The Pointer#i holds the position of the next non-delimiter character to be examined in the Source String . Pointer#i must be large enough to hold a value one greater than the size of the Source String . DELIMITER IN A DELIMITER IN clause is associated with a particular Destination String. HoldDelim$i holds the Delimiter that was encountered in the Source String . ALL When the A LL phrase is used, contiguous delimiters are treated as if only one delimiter had been encountered.
  • 7. UNSTRING Example 1 01 DayStr PIC XX. 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 8. UNSTRING Example 1 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr INTO DayStr , MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 9. UNSTRING Example 1 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. - 0 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 10. UNSTRING Example 1 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. - 0 01 YearStr PIC XX. 5 - 01 DateStr PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 11. UNSTRING Example 1 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. - 0 01 YearStr PIC XX. 5 - 01 DateStr PIC X(8). 1 9 - 0 5 - 8 0 ACCEPT DateStr. UNSTRING DateStr INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING. Chars Left
  • 12. UNSTRING Example 2 01 DayStr PIC XX. 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(14). 1 9 s t o p 0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 13. UNSTRING Example 2 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(14). 1 9 s t o p 0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 14. UNSTRING Example 2 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 01 DateStr PIC X(14). 1 9 s t o p 0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 15. UNSTRING Example 2 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 8 0 01 DateStr PIC X(14). 1 9 s t o p 0 5 s t o p 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "stop" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 16. UNSTRING Example 3 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
  • 17. UNSTRING Example 3 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
  • 18. UNSTRING Example 3 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 8 0 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2
  • 19. UNSTRING Example 3 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 8 0 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold2 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 SPACE Hold2 19 05 80 - /
  • 20. UNSTRING Example 4 01 DayStr PIC XX. 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold1 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1
  • 21. UNSTRING Example 4 01 DayStr PIC XX. 1 9 01 MonthStr PIC XX. 0 5 01 YearStr PIC XX. 8 0 01 DateStr PIC X(8). 1 9 - 0 5 / 8 0 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "/" OR "-" INTO DayStr DELIMITER IN Hold1 MonthStr DELIMITER IN Hold1 YearStr END-UNSTRING. DISPLAY DayStr SPACE MonthStr SPACE YearStr. DISPLAY Hold1 19 05 80 /
  • 22. UNSTRING Example 5 01 DayStr PIC XX. 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY ALL "-" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 23. UNSTRING Example 5 01 DayStr PIC XX. 1 5 01 MonthStr PIC XX. 0 7 01 YearStr PIC XX. 9 4 01 DateStr PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY ALL "-" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 24. UNSTRING Example 6 01 DayStr PIC XX. 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "-" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING.
  • 25. UNSTRING Example 6 01 DayStr PIC XX. 1 5 01 MonthStr PIC XX. 01 YearStr PIC XX. 01 DateStr PIC X(11). 1 5 - - - 0 7 - - 9 4 ACCEPT DateStr. UNSTRING DateStr DELIMITED BY "-" INTO DayStr, MonthStr, YearStr ON OVERFLOW DISPLAY "Chars Left" END-UNSTRING. Chars Left
  • 26. UNSTRING Example 7 01 OldName PIC X(80). 01 TempName. 02 NameInitial PIC X. 02 FILLER PIC X(15). 01 NewName PIC X(30). 01 Pointers. 02 StrPtr PIC 99 VALUE 1. 02 UnstrPtr PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING Display TempName END-PERFORM STOP RUN. Tim John Roberts
  • 27. UNSTRING Example 7 01 OldName PIC X(80). 01 TempName. 02 NameInitial PIC X. 02 FILLER PIC X(15). 01 NewName PIC X(30). 01 Pointers. 02 StrPtr PIC 99 VALUE 1. 02 UnstrPtr PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING Display TempName END-PERFORM STOP RUN. Tim Tim John Roberts T im
  • 28. UNSTRING Example 7 01 OldName PIC X(80). 01 TempName. 02 NameInitial PIC X. 02 FILLER PIC X(15). 01 NewName PIC X(30). 01 Pointers. 02 StrPtr PIC 99 VALUE 1. 02 UnstrPtr PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING Display TempName END-PERFORM STOP RUN. John Tim John Roberts J ohn
  • 29. UNSTRING Example 7 01 OldName PIC X(80). 01 TempName. 02 NameInitial PIC X. 02 FILLER PIC X(15). 01 NewName PIC X(30). 01 Pointers. 02 StrPtr PIC 99 VALUE 1. 02 UnstrPtr PIC 99 VALUE 1. 88 NameProcessed VALUE 81. PROCEDURE DIVISION. ProcessName. ACCEPT OldName. PERFORM UNTIL NameProcessed UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING Display TempName END-PERFORM STOP RUN. Roberts Tim John Roberts R oberts
  • 30. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts
  • 31. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts T im
  • 32. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts T im T .
  • 33. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts J ohn T .
  • 34. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts J ohn T . J .
  • 35. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts R oberts T . J .
  • 36. UNSTRING Example 8 OldName TempName NewName PROCEDURE DIVISION. ProcessName. ACCEPT OldName. UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING PERFORM UNTIL NameProcessed STRING NameInitial "." DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING UNSTRING OldName DELIMITED BY ALL SPACES INTO TempName WITH POINTER UnstrPtr END-UNSTRING END-PERFORM STRING SPACE TempName DELIMITED BY SIZE INTO NewName WITH POINTER StrPtr END-STRING STOP RUN. Tim John Roberts R oberts T . J . Roberts