1 / 8

PACK

PACK. PACK. Instruction type: SS2 Explicit Coding: D1(L1,B1),D2(L2,B2) Example PACK 3(4,5),8(9,7) Example PACK X(3),Y(4) Use: Converts zoned decimal fields to packed, (also works on character fields that only contain digits). What does it do?. PACK X,Y.

helen
Download Presentation

PACK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PACK

  2. PACK • Instruction type: SS2 • Explicit Coding: D1(L1,B1),D2(L2,B2) • Example PACK 3(4,5),8(9,7) • Example PACK X(3),Y(4) • Use: Converts zoned decimal fields to packed, (also works on character fields that only contain digits)

  3. What does it do? PACK X,Y F1 F2 F3 F4 F5 C6 Y 00 00 01 23 45 6C X

  4. What does it do? PACK X,Y F1 F2 F3 F4 F5 C6 Y 45 6C X

  5. PACK • Example use: Assume: X DS PL5 Y DC Z’-234.57’ You execute: PACK X,Y Y Before: F2F3F4F5D7 X After: 000023457D

  6. PACK • Example use: Assume: X DS PL2 (TOO SHORT) Y DC Z’-234.57’ You execute: PACK X,Y Y Before: F2F3F4F5D7 X After: 457D DIGITS TRUNCATED

  7. Programming Tips • Make sure the receiving field will hold the result • Pack works no matter the state of the data. In other words, if you pack garbage, you get more garbage • Pack doesn’t generate a data exception (SOC7) • You won’t discover the data is bad until you do arithmetic – AP, SP, MP, …

  8. Try it in VisibleZ • Try the following programs: • pack.obj • pack1.obj • pack2.obj • pack3.obj • pack4.obj

More Related