57305_771_cl week 5bb

Upload: yashodasree

Post on 05-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 57305_771_CL Week 5BB

    1/25

    Introduction to CL Programming

    Mike PavlakSolutions Consultant

    Zend Technologies, Inc.

    Week Five

  • 7/31/2019 57305_771_CL Week 5BB

    2/25

    Review Week 4

    System Functions Retrieve commands Parameter passing

    Automating Operations Tasks Display file date validation FTP Job Scheduler

  • 7/31/2019 57305_771_CL Week 5BB

    3/25

    This week...Tips and tricks...

    Self submitting CL programs API magic!

  • 7/31/2019 57305_771_CL Week 5BB

    4/25

    Self submitting CL program...

    Three fundamental components Display File CL program Local Data Area

    This program will Receive a Library name from the user Validate the existence of the library Submit itself to batch Reorganize all PF's in the library with deleted

    records...

  • 7/31/2019 57305_771_CL Week 5BB

    5/25

    Data areas...

    Spec's at V5R4 Four Data Types Used to store stuff 4 Types of Data areas

    *LDA Local Data Area *GDA Group Data Area *PDA Program Init Parm Data Area Named Data Area.

    Data Area Specifications

    Max Default

    *CHAR 2000 32

    *DEC 24, 9 15, 5

    *LGL 1 1

    *DDM N/A N/A

  • 7/31/2019 57305_771_CL Week 5BB

    6/25

    Local Data Area (*LDA)...

    Size is *CHAR and 1024 bytes long Every job on system has one CHGDTAARA command to alter All submitted jobs inherit the *LDA Think of it like a cookie for System i job Be careful, other jobs might need it Only current job can see it

  • 7/31/2019 57305_771_CL Week 5BB

    7/25

    DSPDTAARA... Display command for the *LDA, like others

    Name = *LDA Library is blank Output Format, Character or Hex (like dumps)

  • 7/31/2019 57305_771_CL Week 5BB

    8/25

    DSPDTAARA

    Local data area is often blank Some vendors use it for quick access Let's put something in there

  • 7/31/2019 57305_771_CL Week 5BB

    9/25

    CHGDTAARA...

    Only character data CHGDTAARA *LDA 'LIBRARY1'

  • 7/31/2019 57305_771_CL Week 5BB

    10/25

    DSPDTAARA

    See new value Very fast Exists in memory

  • 7/31/2019 57305_771_CL Week 5BB

    11/25

    CL Program...

    Declarations Work fields Two files

  • 7/31/2019 57305_771_CL Week 5BB

    12/25

    CL Program...

    First, determine environment with RTVJOBA RTVJOBA TYPE(&TYPE) TYPE = '1' is Interactive TYPE = '0' is Batch

  • 7/31/2019 57305_771_CL Week 5BB

    13/25

    CL Program... If Interactive...

    Validate library Get library from user via DSPF Validate & store in *LDA Then submit to batch

  • 7/31/2019 57305_771_CL Week 5BB

    14/25

    CL Program... Additional screen processing

    exit program Default Validate entry

  • 7/31/2019 57305_771_CL Week 5BB

    15/25

    CL Program...

    Validation subroutine... CHKOBJ will examine OS for object Set message if error

  • 7/31/2019 57305_771_CL Week 5BB

    16/25

    CL Program... When submitted program is in batch...

    Retrieve library from *LDA DSPFD to outfile and process where

    MLNRTD > 0 & more records Count and accumulate values

  • 7/31/2019 57305_771_CL Week 5BB

    17/25

    CL Program... When submitted program is in batch...

    When EOF is reached, send status message End program

  • 7/31/2019 57305_771_CL Week 5BB

    18/25

    API Processing...

    API = Application Program Interface Just another program Has a specific job to do Some popular API's include

    QCMD Command Screen QCMDCHK Validate CL command QCMDEXC Execute CL command QUSCMDLN Command Line window

    More info online in System API Programming http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/apiref/api.htm

    http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/apiref/api.htmhttp://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/apiref/api.htm
  • 7/31/2019 57305_771_CL Week 5BB

    19/25

    Tweak the previous program...

    Enhance the previous program... Add a command line window Tie to function key in main glass Resume processing when complete

  • 7/31/2019 57305_771_CL Week 5BB

    20/25

    Revise the display file...

    Add function key ... Activate indicator Insert text

  • 7/31/2019 57305_771_CL Week 5BB

    21/25

    Add subroutine to CL...

    This will run only from Interactive Call this subroutine from interactive subroutine Return control to main subroutine when complete

  • 7/31/2019 57305_771_CL Week 5BB

    22/25

    Compile and run...

    Press the key to see results...

  • 7/31/2019 57305_771_CL Week 5BB

    23/25

    Demos as time permits...

    Let's have some fun!

    WDSC in action!

  • 7/31/2019 57305_771_CL Week 5BB

    24/25

    Homework...

    Write and run some CL programs Assignment on website Will not be collected Can forward copies with question via email

  • 7/31/2019 57305_771_CL Week 5BB

    25/25

    Q & A

    Think of some things you would like us tocover...