home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / source / ch22 / chapt22h.cob < prev    next >
Text File  |  1998-09-25  |  2KB  |  40 lines

  1. 000010 @OPTIONS MAIN,TEST
  2. 000020 Identification Division.
  3. 000030 Program-Id.  Chapt22h.
  4. 000040*Assemble Full Name From First And Last
  5. 000050 Environment Division.
  6. 000060 Configuration Section.
  7. 000070 Source-Computer.  IBM-PC.
  8. 000080 Object-Computer.  IBM-PC.
  9. 000090 Data Division.
  10. 000100 Working-Storage Section.
  11. 000110 01  First-Name       Pic X(15)     Value Spaces.
  12. 000120 01  Last-Name        Pic X(25)     Value Spaces.
  13. 000130 01  Work-Field       Pic X(15)     Value Spaces.
  14. 000140 01  Full-Name        Pic X(51)     Value Spaces.
  15. 000150 01  Trailing-Spaces  Pic 9(3)      Value Zeros.
  16. 000160 01  Field-Length     Pic 9(3)      Value Zeros.
  17. 000170 Screen Section.
  18. 000180 01  Data-Entry Blank Screen Auto.
  19. 000190     03  Line 01 Column 1  Value "First Name: ".
  20. 000200     03  Line 01 Column 13 Pic X(15) Using First-Name.
  21. 000210     03  Line 03 Column 1  Value "Last Name: ".
  22. 000220     03  Line 03 Column 13 Pic X(25) Using Last-Name.
  23. 000230     03  Line 06 Column 1  Value "Full Name: ".
  24. 000240     03  Line 06 Column 13 Pic X(51) From Full-Name.
  25. 000250 Procedure Division.
  26. 000260 Chapt22h-Start.
  27. 000270     Display Data-Entry
  28. 000280     Accept Data-Entry
  29. 000290     Move Function Reverse (First-Name) To Work-Field
  30. 000300     Inspect Work-Field Tallying Trailing-Spaces For
  31. 000310                        Leading Spaces
  32. 000320     Compute Field-Length = Function Length (First-Name)
  33. 000330     String First-Name (1:Field-Length - Trailing-Spaces)
  34. 000340            " "
  35. 000350            Last-Name
  36. 000360            Delimited By Size, Into Full-Name
  37. 000370     Display Data-Entry
  38. 000380     Stop Run
  39. 000390     .
  40.