Assembler Concepts Copyright 2008 by David Woolbright



Yüklə 457 b.
səhifə4/8
tarix08.10.2017
ölçüsü457 b.
#3552
1   2   3   4   5   6   7   8

RECFM=(FB)

  • The record format
  • FB – fixed blocked
  • VB – variable blocked
  • F – fixed unblocked
  • V – variable unblocked
  • EODAD=label

    • End of Data Address. Branch here when EOF.
  • LRECL=length

    • Logical Record Length. Take default blocksize.


    Opening and Closing Files

    • OPEN (FILEIN,(INPUT)) THE INPUT FILE

    • OPEN (FILEOUT,(OUTPUT)) MY REPORT

    • ... (process the files)

    • CLOSE FILEIN

    • CLOSE FILEOUT



    Reading and Writing Records

    • * MOVE MODE IO

    • GET FILEIN,RECIN

    • WSPC1 EQU X’09’

    • MVI RECOUT,WSPC1

    • MVC MESSAGEO,MESSAGEI

    • PUT FILEOUT,RECOUT



    Standard Entry and Exit

    • SKELAD4 CSECT

    • * STANDARD ENTRY

    • STM R14,R12,12(R13) STANDARD ENTRY

    • BASR R12,R0

    • USING *,R12

    • ST R13,SAVE+4

    • LA R13,SAVE

    • L R13,SAVE+4

    • * STANDARD EXIT

    • LM R14,R12,12(R13)

    • LA R15,0

    • BR R14



    Save Area (18F)



    Practice Exercise #1

    • Create a PDS member with dates in the following format:

    • YYYYMMDD (columns 1-8)

    • One date per record. Assume valid data.

    • Print Three records for each input record read.

    • Reformat the data in the following format:

    • Year: 2004

    • Month: January

    • Day: 23



    Packed Decimal Data

    • Two decimal digits per byte

    • Sign occurs in the numeric portion of the rightmost byte

    • Valid signs: A,C,F are +

    • B, D are -

    • Preferred signs: C (+), D (-)

    • XPK DC PL3’54’

    • Generates: 00054C



    Example Packed Data Fields

    • APK DC P’12345’ 12345C

    • BPK DC PL2’12345’ 345C

    • CPK DC PL4’123.45’ 0012345C

    • DPK DC P’-345’ 345D

    • EPK DC P’0’ 0C

    • FPK DC P’-1’ 1D



    Zoned Decimal Data

    • One decimal digit per byte

    • Sign occurs in the zone portion of the rightmost byte

    • Valid signs: A,C,F are +

    • B, D are -

    • Preferred signs: C (+), D (-)

    • XPK DC ZL5’-354’

    • Generates: F0F0F3F5D4

    • Some character fields qualify as zoned:

    • X DC C’12345’

    • Generates: F1F2F3F4F5



    Example Zoned Data Fields

    • AZD DC Z’12345’ F1F2F3F4C5

    • BZD DC ZL2’-12345’ F4D5

    • CZD DC Z’-12345’ F1F2F3F4D5

    • DZD DC ZL4’-345’ F0F3F4D5

    • EZD DC Z’0’ C0

    • FZD DC Z’-1’ D1

    • GC DC C’12345’ F1F2F3F4F5



    Packed Instructions - Pack

    • SS2

    • The PACK instruction converts from zoned decimal to packed decimal

    • XZD DC Z’-1234’ F1F2F3D4

    • XPK DS PL4 0001234D

    • PACK XPK,XZD



    Packed Instructions - Pack

    • The receiving field can be too short

    • XZD DC Z’-12345’ F1F2F3F4D5

    • XPK DS PL2 345D

    • PACK XPK,XZD

    • Any data can be packed – results not always good



    Packed Decimal Arithmetic Issues

    • Each operand contains at most 16 bytes – 31 digits plus a sign

    • Data Exceptions occur when performing arithmetic on data that is not packed

    • Loss of precision can occur on ZAP, AP, SP – no notification



    Packed Arithmetic - ZAP

    • SS2

    • Use ZAP to move packed data (not MVC)

    • XPK DS PL4

    • YPK DC P’54’ 054C

    • ZAP XPK,YPK

    • MVC XPK,YPK WHY NOT?

    • Final result in XPK: 0000054C

    • Sets the condition code to Positive, Minus, or equal

    • Test with BP, BM, BE, BNP, BNM, BNE



    Packed Arithmetic - AP

    • SS2 – Add packed

    • Op1 – Target Field (max 16 bytes)

    • Op2 – Source Field (max 16 bytes)

    • The target contains the arithmetic sum of Op1 and Op2

    • Sets the condition code:

      • High – result > 0 Test with BP, BNP
      • Low – result < 0 Test with BM, BNM
      • Equal – result = 0 Test with BZ, BNZ


    Packed Arithmetic - SP

    • SS2 – Subtract packed

    • Op1 – Target Field (max 16 bytes)

    • Op2 – Source Field (max 16 bytes)

    • The target contains the arithmetic result of subtracting Op2 from Op1


    • Yüklə 457 b.

      Dostları ilə paylaş:
    1   2   3   4   5   6   7   8




    Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
    rəhbərliyinə müraciət

        Ana səhifə