Tips 'n' facts.doc

download Tips 'n' facts.doc

of 39

Transcript of Tips 'n' facts.doc

  • 7/26/2019 Tips 'n' facts.doc

    1/39

    Tips n Facts

    (Version 1)

    An e-book on AS/400 programming(OS/400 & !/400)

    - 1 -

  • 7/26/2019 Tips 'n' facts.doc

    2/39

    Tips n Facts

    "re#ace

    In the initial stages of my career as an AS/400 application programmer,I had many questions in my mind, which needed clarications. ThoughI could not get eerything claried I had to get on with myprogramming as per my pro!ect requirements. I had to code in aparticular way without "nowing why it has to #e coded that way. $ow,all those questions in my mind got claried #ut at the cost of time.

    %f late, I reali&ed that had I got claried those questions in my mind Icould hae done much #etter !o# as a programmer in the initial stagesitself. This prompted me to sum up my e'periences as a programmerfor the #enet of the noice programmers. At the same time this #oo"can also sere as a quic" reference for senior programmers.(efore using this #oo", you should #e familiar with generalprogramming concepts and terminology, and hae a generalunderstanding of %perating System/400 )%S/400* and the AS/400system.

    +ou may need to refer to I( manuals for more specic informationa#out a particular topic.

    Author-$aeen ronaalli

    - 2 -

  • 7/26/2019 Tips 'n' facts.doc

    3/39

    Tips n Facts

    O$T%$TS

    T% F'%%$T!* AS+%, %STO$S..............................................

    %SSA%S................................................................................

    %+I$1 2SSA12S 3% %$2 2SSA12 3I52 T% A$%T62......................7%A$S T6AT A$ (2 S2I3I2 I$ T62 282 AA2T2 %3 %$S1...................................................................................................................... 72SSA12 T+2S %$IT%2 (+ %$S1 %A$.................................7

    !2'A'%S................................................................................ %9T 5I(AI2S.....................................................................................7SI1$I3IA$2 %3 :T2 5I(A+................................................................7:15 5I(A+...............................................................................................75I(A+ 5IST................................................................................................. 7$9(2 %3 5I(AI2S A55%;2 I$ T62 9S2 AT %3 T62 5I(A+ 5IST..7%9TI%$ 5I(5, >A559S, >9S5I(5 3% T62 5I(A+ AA2T2.=

    ,ATA2AS% F!%S.......................................................................335AT 3I52....................................................................................................... =2TI2

  • 7/26/2019 Tips 'n' facts.doc

    4/39

    Tips n Facts

    A55

  • 7/26/2019 Tips 'n' facts.doc

    5/39

    Tips n Facts

    T62 L%M A$ LA$M S252T/%IT %$ITI%$S I$ T62 S %3 A 5%1IA53I52.............................................................................................................E0A

  • 7/26/2019 Tips 'n' facts.doc

    6/39

    Tips n Facts

    A""%$,8 9 - S%' ,%F$%, OA$,S.......................................5=

    %A$ STAT22$TS.............................................................................F%A$ %2SSI$1 %1A.............................................................F

  • 7/26/2019 Tips 'n' facts.doc

    7/39

    Tips n Facts

    T>e Fre?@entB AskeC @estions6

    essages

    oD can De copB messages #rom one message Ee to anot>er- 9se the command 1S13. 3or e'ample-

    1S13 3%S13 )+5I(D/S13D* T%S13 )+5I(D/S13E*

    ;>at commanCs can be speciEeC in t>e %8% parameter o# program eGeO$S anC commanC eGe O$S

    - 1%T% is the only alid alue for the 282 parameter on the program leel %$S1.- Any 5 command can #e coded in the 282 parameter of the command leel %$S1.- The action specied on the command leel %$S1 oerrides the action specied on

    the program leel %$S1.

    ;>at message tBpes are monitoreC bB O$S commanC- The %$S1 command monitors only >STAT9S, >$%TI3+ A$ >2SA2 messages It does

    not monitor >I$3% and >I$: messages.

    !ibraries

    ;>at are "roC@ct ibraries- The product li#raries are used to support languages and utilities that are

    dependent on li#raries other than the system li#rary, :S+S, to process theircommands.

    ;>at is t>e signiEcance o# T%" ibrarB- The :T2 li#rary is cleared when a !o# ends.- As S(B%( command initiates a new routing step, :T2 li#rary is not passed on to the

    su#mitted !o# #ut this su#mitted !o# will hae its own :T2 li#rary, which is not isi#leto other !o#s.

    - +ou can moe o#!ect out of :T2 #ut not in to :T2.

    # no c@rrent ibrarB eHists in D>ic> ibrarB Coes a reate commanC createt>e obIect

    - The o#!ect gets created in :15 with reate command.

    s !ibrarB ist an obIect n D>ic> orCer it is searc>eC- 5i#rary list is not an o#!ect.- The order in which the parts of the li#rary list are searched is System, roduct, urrent

    and 9ser.- There is no %S/400 command that saes the user li#rary list. It has to #e ta"en care of in

    the !o# description.

    - 7 -

  • 7/26/2019 Tips 'n' facts.doc

    8/39

    Tips n Facts

    ;>at is t>e maHim@m n@mber o# ibraries aoDeC in t>e @ser part o# t>eibrarB ist

    - A ma'imum of E li#raries can #e present in the user part of the li#rary list.- lease note that li#raries can neer #e created within li#raries.;>at is t>e CiJerence betDeen "roC@ction anC Test ibraries- ata#ase les in roduction li#rary cannot #e opened for update #y a program running in

    de#ug mode if 9% )>$%* was specied on the ST(1 command.- This restriction does not apply to data#ase les in Test li#rary.

    ;>at is t>e signiEcance o# t>e Ga@es K!2!L KA!!S' anC KS'!2! #or t>eibrarB parameter on anB commanC

    - >5I(5 is used to search for an o#!ect in the li#rary list.- >A559S is used to search for an o#!ect in all the user?dened li#raries e'isting on

    the system.- >9S5I(5 is used to search for an o#!ect only in the user part of the li#rary list.

    ,atabase Fies

    ;>at is a Mat Ee- It is a le created with out any S. ecord length has to #e gien. 3or e'ample-

    T3 3I52 )+5I(D/3D* 52$ )DFE*- The elds for this le can #e descri#ed with in the program in which it is #eing used.

    6ence it is also called program?descri#ed le.

    # a ! program contains t>e re#erence to a Mat EeL >oD can t>e Cata beretrieGeC in t>e program

    - The data can #e retrieed from the aria#le J3I52$A2.

    oD manB recorC-#ormats can a Catabase Ee >aGeL D>ic> is CecareC in !- %nly data#ase les with single record format can #e used in a 5 program.- lease note that the data#ase le need not hae mem#er when it is referred to

    create a program.

    ;>at commanCs are aoDeC on a Catabase Ee CecareC in !- %nly e EeCs o# a EeL D>ic> is CecareC in a !- If a data#ase le is declared in 5, the elds in the le are automatically declared in the

    5 program with J pre'ed to it.- lease note that the aria#le name in 5 must #egin with J followed #y not more than

    D0 characters.

    oD can CeEne a Ee member- A mem#er is a su#set of records in a physical le )3?S or 3?TA*. 2ach

    mem#er conforms to the characteristics of the le.

    - 8 -

  • 7/26/2019 Tips 'n' facts.doc

    9/39

    Tips n Facts

    - 3or 3?S mem#ers, you can dene the type of a mem#er as well. 3or e'ample5, 152, 3, 53 etc.

    ;>at >appens i# a Ee is createC Dit> eHpirB Cate ess t>an c@rrent Cate- If a le is created with 28AT2 less than current date the le gets created #ut mem#er

    is not added on creation. An error message is sent at the time of creation saying that the28AT2 is inalid.

    ;>at is t>e signiEcance o# ,*$S!T keBDorC in a ogica Ee- +$S5T "eyword does the S252T/%IT processing when a program reads records, rather

    than when records are added or changed.

    Are keB EeCs manCatorB #or ogica Ees an ogica Ees be Io@rnaeC- ey elds are not mandatory for logical les. 5ogical les cannot #e !ournaled.

    oD manB co@mn >eaCings can be speciEeC #or a EeC in a p>Bsica Ee- 3or a eld in a physical le, F column headings of not more than E0 #ytes each can #e

    specied.

    ;>at are Gario@s tBpes o# access pat> maintenance- ;ith AI$T )>I2*, the access path is updated each time a record is changed, added,

    or deleted from a mem#er. >I2 must #e specied for les that require unique "eys.- ;ith AI$T )>2(5*, the entire access path is re#uilt when the le is opened.- ;ith AI$T )>5+*, the access path is changed only for records added, changed, or

    deleted since the last open.

    ;>B Do@C Bo@ pre#er O"$'*F to !F ;>en Do@C Bo@ pre#er an !F

    O"$'*F !F

    ;e prefer %$:+3 when selectioncriterion gets changed frequently.

    ;e go for logical le, when selectioncriterion is permanent.

    %$:+ is a temporary le, it does notta"e any space on the dis".

    53 is a permanent le and it ta"es spaceon the dis".

    As it has to process the query eery time,the run time for a particular program will#e more.

    un time for a particular program will #erelatiely less.

    ;>at is FieC 'e#erence Fie- A 3ield eference 3ile contains !ust the eld descriptions. It does not contain any data. It

    is used as reference for the eld description for other les. This is used to simplify recordformat descriptions and to ensure eld descriptions are used consistently.

    ;>at is t>e @se o# 'N"F- The eorgani&e hysical 3ile em#er )1C3* command is used to compress )remoe

    deleted records from* the mem#er of a physical le in the data#ase.

    - 9 -

  • 7/26/2019 Tips 'n' facts.doc

    10/39

    Tips n Facts

    nCer D>at circ@mstances De Di not be abe to Ceete a "F- ;hen there are dependent 5ogical 3iles- ;hen there is no authority- ;hen the 3 is loc"ed or in use

    ;>en Co De @se !OF commanC- ;hen a le is opened using either %$:+3 or %$(3 command, 5%3 commandshould #e used to close the opened le.

    ,ispaB Ees

    oD act@aB S$,'VF Dorks- The command S$> causes data to #e returned to the program. A "ey dened with

    A>> does not.

    ;>at Do@C be t>e eJect on a EeC Dit> t>e #ooDing CispaB attrib@tesreGerse imageL @nCerineL anC >ig> intensitB D>en @seC toget>er

    - The eld will not #e displayed i.e. #ecomes non?display.

    ;>at is t>e CiJerence betDeen $on-CispaB anC iCCen EeCs- $on?display ? auses the data in the eld to #e inisi#le to the operator. The display

    positions for the elds appear to #e #lan". 9se this attri#ute for passwords or othersecurity?sensitie data. $on?display elds do not print.- 6idden ? Type 6 to indicate a hidden eld )one that is used for #oth input and output #ut

    not displayed*.

    OV',2F & O"$'*F

    ;>at is t>e necessarB commanC neeCeC be#ore O"$'*F anC D>B- %

  • 7/26/2019 Tips 'n' facts.doc

    11/39

    Tips n Facts

    ;>at is t>e signiEcance o# S%O$!* parameter on O"$'*F commanC- The S2:%$5+ )Sequential %nly* parameter indicates that the le will #e processed

    sequentially )Arrial Sequence* and that one record at a time will #e transferred from thedata#ase to the programMs internal #uPer.

    ",

    ;>at is t>e se?@ence in D>ic> ", options are processeC- If you select more than one option on a list display, the options are

    processed sequentially, starting with the rst option selected.

    ;>at are t>e gro@pings options on ",- ;hen you select an option and press 2nter, rst determines whether it is a

    grouping option.- The opy option, the ename option, the elete option, and the oe option are

    grouping options. If it is a grouping option, a grouping display is shown, listing allthe items for which a particular option was chosen and requesting conrmation)and, possi#ly, additional input*.

    ommanCs

    s t>ere anB simiaritB betDeen t>e commanCs A!O29 anC +O29- (oth the commands do chec"ing for the e'istence of an o#!ect. A5%(B command

    allocates the o#!ect in addition to performing the e'istence chec".

    ;>at Coes ,S""'%F Co- isplays the list of all o#!ects used in the program.

    ;>at act@aB '!'S commanC Coes- The resources that are reclaimed #y this command are

    Static storage

    %pen les of o#!ect type >3I52

    9ser interface manager )9I* application resources

    ommon rogramming Interface )I* ommunications conersations

    6ierarchical le systems )63S* resources

    9ser?dened communications sessions.

    - 3or an original program model )%* program, its static storage will #e reclaimed.- 3or an Integrated 5anguage 2nironment )I52* program, its static storage will #e

    mar"ed so that it will #e re?initiali&ed on the ne't call.- Static storage is not aPected for a serice program, or any I52 program running in

    an actiation group other than the default actiation group.- The 5S command is not needed to reclaim the les and static storage of

    most programs, such as 5 programs that end )return* normally, 1 programsthat hae the last record )5* indicator set on, and %(%5 programs.

    - 11 -

  • 7/26/2019 Tips 'n' facts.doc

    12/39

    Tips n Facts

    ;>at is t>e CiJerence betDeen t>e commanCs A!!L '%T'$L TF'T!- In a A55, the calling program receies the control after the called program

    nishes the processing at the command after the call to called program. ontrol isthus returned up the program stac".

    - The 2T9$ command has no parameters and remoes the program from theprogram stac". If no 2T9$ statement is coded in a 5 program, a return is

    performed after the last e'ecuta#le statement is performed.- The T3T5 command transfers the control to the program and remoes thetransferring program from the program stac". It returns the control to thestatement after the most recently run A55 command in the program that calledthe transferring program. $o statements after the T3T5 in a 5 program will #ee'ecuted.

    ;>B cant retrieGe commanCs be @seC on t>e commanC ine- etriee commands can not #e used on command line, as those commands need a

    aria#le to store the retrieed alue.- lease note that retriee commands can not #e used een in a call to :28.

    Operators

    ;>at are t>e Gario@s concatenation operators in a ! program- The >AT operator concatenates two character strings. (lan"s are included in the

    concatenation. 3or e'ample-

    A( >AT 23 #ecomes A(23QA( Q >AT Q23 Q #ecomes QA( 23 Q

    - The >(AT operator truncates all trailing #lan"s in the rst character stringR one #lan" is

    inserted, then the two character strings are concatenated. 5eading #lan"s on the secondoperand are not truncated. 3or e'ample-

    A( >(AT 23 #ecomes A( 23QA( Q >(AT 23 #ecomes QA( 23Q

    - The >TAT operator truncates all trailing #lan"s in the rst character string, then the twocharacter strings are concatenated. All leading #lan"s on the second operand are nottruncated. 3or e'ample-

    A( >TAT 23 #ecomes A(23QA( Q >TAT 23 #ecomes QA(23QA( >TAT Q 23Q #ecomes QA( 23QQA( Q>TAT Q 23Q #ecomes QA( 23Q

    - All #lan"s that surround the concatenation operator are ignored, #ut at least one #lan"must #e on each side of the resered alue operator )>AT, >(AT, or >TAT*. If multiple#lan"s are wanted in the e'pression, a quoted character string )a character stringenclosed within apostrophes* must #e used.

    - 12 -

  • 7/26/2019 Tips 'n' facts.doc

    13/39

    Tips n Facts

    ;>at are t>e Gario@s tBpes o# operators t>at can be @seC in !- There are four #road categories of operators. 2ach operator can #e replaced #y a

    special character as shown #elow-

    5ogical

    operator

    >A$ >%

    Specialcharacter

    J

    haracteroperator

    >AT >(AT >TAT

    Specialcharacter

    U

    Arithmeticoperator

    A S9( 95T I /

    elationaloperator

    >2: >1T >5T >12 >52 >$2 >$1 >$5

    Specialcharacter V U V UV WV W WU

    enera

    ;>at is t>e CiJerence in assigning Ga@e to a c>aracter Gariabe Dit>apostrop>es anC Dit> o@t apostrop>es in a ! program

    - ;hen you assign alue to a character aria#le without apostrophes the alue would #etranslated to uppercase.

    - The alue is assigned as it is in case of assigning with apostrophes.- Also o#sere the assignment for the aria#les in the following e'ample-

    5 6A* 52$)D0*5 2* 52$)D0*

    61

  • 7/26/2019 Tips 'n' facts.doc

    14/39

    Tips n Facts

    ;>at is t>e CiJerence betDeen contin@ing a so@rce statement Dit> a p@ssign (P) anC a min@s sign (-)

    - The diPerence is that all the #lan"s in the ne't record that precede the rst non?#lan"character are ignored when a plus sign is coded and included when a minus sign iscoded.

    ;>at is asBnc>rono@s comm@nication- It is the communication in which one of the commands waits for the output from

    another command to get e'ecuted. This inoles ;AIT parameter.- In the #elow e'ample the e CiJerent DaBs to pass Cata betDeen programs ;>ic> one ist>e most eQcient DaB

    - arameters, ata area, ata queue, essage queues, 3iles- ata queues are the most eXcient way of data transfer.

    %Hpain abo@t A anC SAA- ommon 9ser Access standards )9A* are the standards for designing user interface of

    an application.- System Application Architecture standards )SAA* are the standards for coding.

    ;>at is 9ob ,escription- The !o# description may contain request data that causes a program or a command to

    run.- Bo# descriptions can also specify what user prole the !o# should run under.- The wor"station entry tells what !o# description will #e used when a !o# starts at that

    wor"station.

    ;>at is an a@t>oriRation ist- An Authori&ation list contains the access rights for indiidual users and groups of users

    for the functions such as tas"s, menus, #atch enironments, data sets and so on. 3oreach authori&ation list, D0 leels of authori&ation rights can #e dened )0 to @*. 5eel 0means no authori&ation and a leel greater than 0 means authori&ation. +ou can securean o#!ect #y the authori&ation list.

    ;>at are t>e GaiC Cata tBpes on AS/400

    - The alid data types are%ntrB eaning

    A haracter ac"ed decimalS Coned decimal( (inary3 3loating point6 6e'adecimal5 ate

    - 14 -

  • 7/26/2019 Tips 'n' facts.doc

    15/39

    Tips n Facts

    T TimeC Timestamp

    ;>at is t>e CiJerence betDeen nteractiGe anC 2atc> Iobs

    - 5 commands are used in either #atch or interactie !o#s.- The AS/400 system proides many menus and displays to assist the programmer,

    including the rogrammer enu, the ommand 2ntry display, command prompt displays,and the rogramming eelopment anager )* enu to ma"e interactie entries.- Interactie !o# has to wait for the issued command to complete to continue with another

    command.- S(B%( command causes the command to run in #atch.- S(B%( command causes the program that issues it to continue without waiting for the

    issued command to complete.- In case of an e'ception, if the program is running in an interactie !o#, the system sends

    the message to the !o#Qs e'ternal message queue. If the program is running as a #atch!o#, the system sends the message to the system operator message queue, :S+S%.

    - 15 -

  • 7/26/2019 Tips 'n' facts.doc

    16/39

    Tips n Facts

    T>e Tips6

    To GieD t>e program so@rce De generaB @se or = option on ",. s t>ereanB ot>er DaB to it

    -

    Try using the following commands to iew the code-

    S3 3I52 )S3* ( )%1A $A2*S3 3I52 )S3* ( )%1A $A2*

    T>e '$'* commanC CispaBs t>e recorCs b@t it is not possibe to EnC apartic@ar string in t>e Ee recorCsL as t>e EnC option is not proGiCeC.s t>ere anB DaB o@t

    - Try using the following commands to nd a particular string-

    S3 3I52 )3I52 $A2*S3 3I52 )3I52 $A2*

    oD can knoD t>e sBstem CateL its #ormat etc.- 9se SS+S

  • 7/26/2019 Tips 'n' facts.doc

    17/39

    Tips n Facts

    - rogram o#sera#ility consists of two types of data, namely e#ug ata and reationata-

    - e#ug ata represented #y the >(1TA alue. This data is necessary to allow aprogram to #e de#ugged.

    - reation ata represented #y the >TTA alue. This data is necessary to translate thecode to machine instructions. The program must hae this data for you to change the

    program optimi&ation leel.- 9sing the hange rogram )611* command, you can remoe either type of datafrom the module, or remoe #oth types. emoing all o#sera#ility reduces the programto its minimum si&e )with compression*. %nce this data is remoed, you cannot changethe program in any way unless you compile the program again and replace the data. Tocompile it again, you must hae authority to the source code.

    ;>at is optimiRation- %ptimi&ation is a process where the system loo"s for processing shortcuts that reduce

    the amount of system resources necessary to produce the same output.- %ptimi&ation remoes redundant instructions.- To optimi&e, set the %TIIC2 attri#ute on a 611 command to >+2S.

    ;>at is t>e signiEcance o# "'O29 commanC- 9se ompress %#!ect )%(B* command to compress selected o#!ects in order to

    sae dis" space.- +ou can use the ecompress o#!ect )%(B* command to decompress o#!ects

    that hae #een compressed.- lease note that the data#ase les can not #e compressed.

    oD Co knoD D>et>er an obIect is compresseC or not- 9se S%(B %(B )T2STD* %(BT+2 )>1* 2TAI5 )>3955* to "now the

    compression status.- ompressed o#!ects are temporarily or permanently decompressed when used,

    depending on the o#!ect type and usage.- 3or e'ample >1 is automatically permanently decompressed when used. >3I52

    is automatically decompressed when opened. If only description is retrieed,>3I52 is temporarily decompressed.

    oD can Bo@ retrieGe t>e program name in a ! program- Send a program message )S$1S1* to this !o# and receie )

  • 7/26/2019 Tips 'n' facts.doc

    18/39

    Tips n Facts

    an pass a n@meric Gariabe #or t>e ca to a program #rom commanC ine- +es, the he'adecimal alue of the numeric aria#le has to #e passed. The

    following call command shows how to pass the alue E. to a program aria#lethat is declared as 52$)D * in he'adecimal alue

    A55 1A A )8M0E03M*

    oD can Bo@ reaC a partic@ar member o# a p>Bsica Ee in Bo@r program- ention the physical le mem#er name you want to read on data mem#er )TA(*

    parameter of T53 command and use that logical le to read.

    eneraB ST'S,2 is @seC #or Ceb@gging !". an Ceb@g a !" @singST',2 commanC

    - +es. The steps inoled are as follows-ompile 5 using with Source listing optionsY >S(1.Then issue commandY ST(1 1 )1D* %S )>+2S*

    - 3ollow the same process for de#ugging 1 also.

    t is GerB time cons@ming to go to spoo anC searc> #or t>e spoo Ee #or t>eatest compiation maCe. s t>ere anB DaB o@t

    - Try this. If you are compiling a source #y name 1D, use the following commandto see its spool-

    SS53 3I52 )1D* S5$( )>5AST*

    an knoD in D>at a ! program obIects a partic@ar commanC is being@seC

    - 9se T9S1 )rint ommand 9sage* command.

    s it possibe to >aGe CiJerent Cescriptions #or a so@rce anC its obIect- +es, it is possi#le. ;hen you try to compile a source the default for o#!ect te't is

    >S(T8T. Instead of >S(T8T you can type your own te't.- lease note that this is alid only for o#!ects created from sources.

    oD can De take a back @p o# t>e spoo Ee- reate a physical le with record length V 5ength of the record in spool G DE.

    T3 3I52 )+5I(D/S%%5* 52$ )D44*- %pen the spool le with option E )61S53A* and ma"e note of Spooled le, Bo#

    name, 9ser, $um#er, Spooled le num#er.- 9se +S53 command as follows to copy the spool le to physical le S%%5-

    +S53 3I52 )1D* T%3I52 )+5I(D/S%%5* B%()@@=D/Z

  • 7/26/2019 Tips 'n' facts.doc

    19/39

    Tips n Facts

    oD can knoD a t>e commanCs starting Dit> a partic@ar string- 3or e'ample if you want to "now all the commands starting with string 61 type

    61> on command line and press enter.

    ;>at is t>e signiEcance o# 'S' (erge so@rce) commanC-

    If you are maintaining two copies of the same source and if one of the copies isupdated, you can re[ect those updates in other copy #y using 1S command)option on *.

    oD can searc> #or a string in a t>e members o# a so@rce p>Bsica Ee- Type option E on rst mem#er in the source physical le.- ress 3DF. %ption E is repeated for all the mem#ers. ress 2nter.- 3ind String display is shown. 2nter the string you want to search for and press

    2nter.- The mem#ers haing the string in them are displayed one after another #y

    pressing 2nter.- The other way is to use 3$ST command as follows-

    3$ST STI$1 )Q61Q* 3I52 )+5I(D/:5S* ( )>A55* %TI%$)>S*

    ;>at are ser-CeEneC options- ;ith user?dened options, you can call your own commands from any list

    display. These options ma"e it easier for you to do frequent operations, #ecauseyou can type an option on a list display instead of retyping an entire command.

    - The process to create an user?dened option is as follows-- ress 3DK on . ;or" with 9ser?ened %ptions display is shown.- ress 3K. reate 9ser?ened %ption display is shown. Type the option and

    command. 3or e'ample- 6195I( 95I( )J5*- $ow you can use instead of 6195I( as an option on .

    an @se "*F commanC #or copBing a ogica Ee- If you try to copy a logical le using +3 command a physical le with the same name is

    created. Therefore T9%(B command should #e used.

    oD can knoD t>e CepenCant ogica Ees on a p>Bsica Ee- The S( command on a physical le can #e used to display a list of dependent

    logical les #y default.

    oD can knoD a t>e Ees @sing t>e #ormat o# a p>Bsica Ee- 9se S( command with 3T parameter on a physical le.

    For D>at a in#ormation can @se ,S"F, commanC- 9se S3 command to "now the num#er of records in a data#ase le.- 9se T+2 )>(5IST* parameter on S3 command to "now the mem#ers in a le.- 9se T+2 )>S252T* parameter on S3 command to "now the select/omit rules in a

    logical le.- 9se T+2 )>B%I$* parameter on S3 command to "now the !oin description in a !oin

    logical le.

    - 19 -

  • 7/26/2019 Tips 'n' facts.doc

    20/39

    Tips n Facts

    an knoD t>e recorC co@nt in a Ee @sing '$'* commanC- 9se %9T3% )>S9A+* parameter on 9$:+ command to "now the num#er of

    records in a le.

    an seect recorCs #rom a Ee baseC on certain criteria @sing '$'*commanC

    - 9se 9$:+ :+3I52 ))3I52$A2** S5T )>+2S*.

    oD Co speci#B t>e O' anC A$, seect/omit conCitions in t>e ,,S o# aogica Ee

    - The % condition for select rule in 53-

    A S 2AT %)2: LDD7M*A S 2AT %)2: LDFDM*

    - The A$ condition for select rule in 53-

    A S 2AT %)2: LDD7M*A 2AT %)2: LDFDM*

    an aGoiC @nCerining o# inp@t EeCs on CispaB Ee screen- (y specifying 61I$3T at the le leel or record leel or eld leel the underlining of

    input elds on the screen #e preented.

    an retain t>e screen a#ter cosing t>e CispaB Ee- 9sing the 22 "eyword at the record leel will preent the screen from #eing erased

    when the display le is closed.

    an Bo@ copB t>e recorCs createC bB t>e O"$'*F to ot>er Ees- +es, #y using +3:+3.

    oD to print t>e >ep #or one ! commanC keBDorC parameter- 3rom a command line, type the 5 command name and press 34 to display the command

    prompt display. osition the cursor anywhere on the line of the "eyword parameter forwhich you want help. ress 3D to display the help for the "eyword parameter. ress 3D4to print the help.

    ;e can restore t>e so@rce c>anges b@t not t>e so@rce Cate #or a partic@arine o# coCe. s t>ere anB DaB o@t

    - 3or e'ample if you want to change the source date for a particular line of code inmem#er 1D in +5I(D/:5S, the steps inoled would #e-

    - %

  • 7/26/2019 Tips 'n' facts.doc

    21/39

    Tips n Facts

    T>e sBstem creates a Iob og D>en it is iCe ong eno@g> anC t>e sBstemogs t>e @ser o@t b@t >oD can >aGe t>is createC a t>e time i.e.D>eneGer a @ser signs o@t

    - Ta"e prompt for SI1$%33 command and change the !o# log parameter to >5IST.

    s it possibe to @se S! in ! programs- S:5 in 5 is no pro#lem. Add this line to your 5 program )+51D*-

    9$S:5ST S3I52)+5I(D/:5S* S()+S:5D* %IT)>$%$2*

    - reate +S:5D mem#er with the required S:5 statements- )the mem#er type in isQS:5Q instead of Q5Q*

    252T2 3% +5I(D/TA3I52R

    - $ote- 9$S:5ST runs the whole S:5 mem#er, no way to select only one statement ofit. So you must create more S:5 mem#ers for a 5, if you need to run the statementsfrom seeral places of your 5. erhaps li"e this- 5 V +51, S:5 mem#ers-+51D, +51E, ... then you hae them right #elow the 5 in . See the QRQ atthe end of each line. ItQs important.

    oD can aGoiC stat@s message D>ie r@nning commanCs ike "*FLO"$'* etc. in a ! program

    - The following code will aoid status message-5 6A* 52$ )7*T$%$2*

    +3Y

    61B%( STSS1 )JSTSS1*

    oD to @se ,%82'ecute ommand ):28* is an I(?supplied program that runs a singlecommand. This command is used to actiate another command. After the commandgets e'ecuted the control returns to your 5 program.The command runs as if it was not in a program. Therefore, aria#les cannot #e usedon the command #ecause alues cannot #e returned #y the command to 5aria#les. Additionally, the :28 program cannot run commands that can only#e used in 5 procedures or programs. The format of the call to the :28program is the following-

    A55 1 ):28* A )command command?length*

    2nter the command you wish to run as a character string on the rst parameter. +oumust enclose the command in apostrophes if it contains #lan"s. The ma'imumlength of the character string is K000 characters. $eer count the delimiters )theapostrophes* as part of the string. The length that is specied as the second alue onthe A parameter is the length of the character string that is passed as thecommand. 5ength must #e a pac"ed decimal alue of length D with decimal

    - 21 -

  • 7/26/2019 Tips 'n' facts.doc

    22/39

    Tips n Facts

    positions. Thus, to replace a li#rary list, the call to the :28 program would loo"li"e this-

    A55 1 ):28* A )Q615I(5 5I(5 ):15 $2;5I( :T2*Q FD*

    - 22 -

  • 7/26/2019 Tips 'n' facts.doc

    23/39

    Tips n Facts

    T>e Facts6

    D. A 5 program can handle up to D000 %$S1 commands. 9p to 0 message identierscan #e entered on a S1I parameter for a %$S1 command.

    E. 9p to D0 programs can #e de#ugged simultaneously in a !o#.

    F. 5 does not support &oned and #inary aria#les. It supports only pac"ed aria#les.

    4. The ma'imum num#er of parameters that can #e passed to another program is 40.

    . There is no limit on command la#el length as long as the la#el ts on one line in thesource record.

    K. 9p to D0 leels of em#edding are permitted in 5. 5et us see the I3 condition em#edding.2.g. I3 )AVD* T62$ )I3 )(VE* T62$ )I3 VF* T62$ )%***

    7. ;hen a call command is run in #atch mode, aria#les passed as arguments aretreated as constants.

    =. 5 does not support arrays. 5 does not support AS2 statement.

    @. A null alue can not #e passed to another program.

    D0. 5 cannot #e used for processing printer or I3 les.

    DD. All "eywords in a 5 command can #e coded positional.

    DE. The command : is used to display command entry screen.

    DF. The command %

  • 7/26/2019 Tips 'n' facts.doc

    24/39

    Tips n Facts

    AppenCiH A - sing ommanC prompts

    - %n a prompt display of a command, enter LHL on a eld to "now the permissi#le aluesfor that eld. This character can #e used in all entry elds. It performs the same function

    as the 34 )rompt* "ey.

    - %n a prompt display of a command, enter LJL to increase the length of the entry eld. If aparticular input eld is not large enough for the parameter alue or alues you want totype, you can e'pand the eld #y using the ampersand )J*. The eld will e'pand to thene't larger length of E, =0, DFE, EK, or DE characters.

    - If you type a less than sign )U* followed #y at least one #lan" in place of the rstcharacter of a alue, that alue is deleted. This character can #e used only in elds thatallow a list of alues.

    - (y typing a greater than sign )* in the input eld, you tell the system you want to typeadditional alues ahead of that alue. %n an input eld that already contains a alue,

    type the oer the rst character of the alue and press the space#ar or press the 3ield2'it "ey to remoe the remaining characters. Then press the 2nter "ey. The alue in theinput eld where you typed the is not lost. ;hen you enter the additional alues andpress the 2nter "ey, the replaced alue reappears following the inserted alue. Thischaracter can #e used only in elds that allow a list of alues.

    AppenCiH 2 - SeectiGe prompting c>aracter.

    The special prompt characters help us in displaying command prompts #oth oncommand line and while running the programs. 3or e'ample the commandH ;( will display the prompt as if 34 is pressed. 5et us see how otherswor"Y

    - ;( HH3I52 )>$*The parameter is displayed and input?capa#le.

    - ;( H>3I52)>$*The parameter is displayed #ut not input?capa#le.

    - ;( HU3I52)>$*The parameter is displayed and input?capa#le, #ut the command default is sent tothe unless the alue displayed on the parameter is changed.

    - H ;( H?3I52)>$*The parameter is not displayed. The specied alue is passed to the . $ot allowedprompt oerride programs.

    - ;( HJ3I52)>$*The parameter is not displayed until 3@ is pressed and the parameters are input?capa#le.

    - ;( HN3I52)>$*The parameter is not displayed until 3@ is pressed and the parameters are not input?capa#le.

    - 24 -

  • 7/26/2019 Tips 'n' facts.doc

    25/39

    Tips n Facts

    - H/ esered for I( use.

    - 25 -

  • 7/26/2019 Tips 'n' facts.doc

    26/39

    Tips n Facts

    AppenCiH - ObIect A@t>orities anC !ock states

    ObIect A@t>orities

    A user can #e gien one of the following authorities to o#!ects- >A55, >28592,

    >9S2, >6A$12.

    ObIectA@t>oritB

    ---------------ObIect-------------- --------------------,ata---------------------

    % 1T 28IST A5T2 23 2A A 9AT2 252T2 2829T2>A55 8 8 8 8 8 8 8 8 8 8>28592>9S2 8 8 8>6A$12 8 8 8 8 8 8

    $ote- +ou can type an O8O or a #lan" to gie or remoe o#!ect/data authorities. 3orsome >3I52 o#!ects, a O/O may appear in the column. A O/O indicates that the user hasthe specied authority to some, #ut not all of the elds in the le.

    - %#!ect operational authority ? It proides the user authority to display the o#!ectMsattri#utes.

    - %#!ect management authority ? It proides authority to specify security, to moeor rename the o#!ect, and to add mem#ers if the o#!ect is a data#ase le.

    - %#!ect e'istence authority ? It proides authority to control the o#!ectQs e'istenceand ownership.

    - %#!ect alter authority ? It proides authority to change the attri#utes of an o#!ect,such as adding or remoing triggers for a data#ase le.

    -%#!ect reference authority ? It proides authority to specify the o#!ect as the rstleel in a referential constraint.

    - ead authority ? It proides authority to access the contents of the o#!ect.

    - Add authority ? It proides authority to add entries to the o#!ect.

    - 9pdate authority ? It proides authority to change the content of e'isting entriesin the o#!ect.

    - elete authority ? It proides authority to remoe entries from the o#!ect.

    - 2'ecute authority ? It proides authority to run a program or search a li#rary or

    directory.

    - 26 -

  • 7/26/2019 Tips 'n' facts.doc

    27/39

    Tips n Facts

    ObIect !ock states

    %#!ects are allocated on the #asis of their intended use and whether they can #eshared. A loc" state identies the use of the o#!ect and whether it is shared. The eloc" states are as follows-

    -

    2'clusie )>285* ? The o#!ect is resered for the e'clusie use of the requesting!o#. $o other !o# can use the o#!ect.

    - 2'clusie allow read )>285* ? The o#!ect is allocated to the !o# that requestedit #ut other !o#s can read the o#!ect.

    - Shared for update )>S69* ? The o#!ect can #e shared either for update or readwith another !o#.

    - Shared no update )>S6$9* ? The o#!ect can #e shared with another !o# if the!o# requests either a >S6$9 loc" state or >S6 loc" state.

    - Shared for read )>S6* ? The o#!ect can #e shared with another !o# if the userdoes not request e'clusie use of the o#!ect.

    9se ;B%( )wor" with !o#* command and ta"e option LDEM to display the loc" statesfor o#!ects. 9se ;%(B5 );or" with o#!ect loc"s* to display the loc" state for aspecied o#!ect.

    - 27 -

  • 7/26/2019 Tips 'n' facts.doc

    28/39

    Tips n Facts

    AppenCiH , - essage ?@e@es anC essages

    TBpes o# message ?@e@es

    All messages are sent to the message queue. In addition to the #elow message

    queues, you can create your own message queues for sending messages to systemusers and #etween application programs.

    - ;orkstation message ?@e@eis used for sending and receiing messages#etween wor"station users and #etween wor"station users and the systemoperator.

    - ser proEe message ?@e@ecan #e used for communication #etween users. Itis automatically created when the user prole is created.

    - 9ob message ?@e@eis used for receiing requests to #e processed and forsending messages that result from processing the requests. It e'ists for each !o#and only e'ists for the life of !o#. It consists of an e'ternal message queue )>28T*and a set of program message queues.

    - SBstem operator message ?@e@e (S*SO"')is used for receiing andreplying to messages from the system, display station users, and applicationprograms.

    - T>e >istorB og message ?@e@eis used for sending information to the historylog ):6ST* from any !o# in the system.

    TBpes o# messages

    - n#ormationa (K$FO)message that coneys information a#out the condition ofa function.

    - n?@irB (K$)message that coneys information and also as"s for a reply.- $oti#B (K$OTF*)message that descri#es a condition for which a program

    requires correctie action.- 'e?@est (K'S)message that requests a function from the receiing program.- ompetion (KO")message that coneys completion status of wor".- ,iagnostic (K,A)message a#out errors in the processing of a system

    function.- Stat@s (KSTATS)message that descri#es the status of the wor" done #y a

    program. Status messages sent to the e'ternal message queue )>28T* is shown atthe display station.

    - %scape (K%SA"%)message that descri#es a condition for which a programmust end a#normally.

    The message identier you specify on the AS1 command is used to refer to themessage and is the name of the message description. The message identier must#e of 7 characters-

    """$$

    ;here """is the product or application code, is the numeric group code and $$is the numeric su#type code. The num#er specied as $$can #e used to furtherdiide a set of product or application messages. $umeric group and su#type codesconsist of decimal num#ers 0 through @ and the characters A through 3.3or e'ample- 3DEF4 is message DEF4 of 3.

    - 28 -

  • 7/26/2019 Tips 'n' facts.doc

    29/39

    Tips n Facts

    +ou should use care in using a numeric su#type code of 00 in the message identier.If you use a numeric su#type code of 00 for a message that can #e sent as anescape, notify, or status message and that can, therefore, #e monitored, a su#typecode of 00 in the onitor essage )%$S1* command causes all messages in thenumeric group to #e monitored.

    VaiC message tBpes #or message ?@e@e tBpesessageTBpe

    essage @e@e TBpe

    %Hterna "rogram S*SO"' ;orkstation

    ser

    Informational 8 8 8 8 8Inquiry 8 8 8 8ompletion 8 8 8 8 8iagnostic 8 8 8 8 8equest 8 82scape 8Status 8 8$otify 8 8

    essage tBpes t>at can be senC Dit> CiJerent message senCing commanCsSenCingmessage

    essage TBpe

    K$FO K$ K'S KO" K,A K$OTF* K%SA"%

    KSTATS

    S$S1 8 8S$9SS1

    8 8

    S$1S1

    8 8 8 8 8 8 8 8

    S$(S1

    8 8

    S$,S (SenC message)

    - Itcan #e used on a command line.- It can not use messages in message le for sending messages. It can only use the

    message te't entered #y the user.- It can #e used to send message either to a user prole or a message queue.- The type of messages allowed on S$S1 are >I$3%, >I$:.

    2.g. S$S1 S1)QAS/400 2SSA12 3I52Q* T%9S)ZI$:* +S1: )Z

  • 7/26/2019 Tips 'n' facts.doc

    30/39

    Tips n Facts

    - 3or >$%TI3+, >2SA2, >STAT9S messages essage Id and essage le aremandatory. It does not ta"e message te't entered #y the user.

    2.g. 3or status message-S$1S1 S1I)A0000D0* S13)S13D* T%1:)>28T* G

    S1T+2)>STAT9S*

    3or message at display station-S$1S1 S1I)A0000D0* S13)S13D*

    S$,S'S (SenC @ser message)

    - It can not #e used on a command line.- It can use messages in message le for sending messages. It can also use the

    message te't entered #y the user.- It can #e used to send message either to a user prole or a message queue.- The type of messages allowed on S$S1 are >I$3%, >I$:.

    2.g. S$9SS1 S1)QAS/400 2SSA12 3I52SQ* T%9S)Z

  • 7/26/2019 Tips 'n' facts.doc

    31/39

    Tips n Facts

    AppenCiH % - :2$A'* anC :S;T b@it-in F@nctions

    sing t>e :2$A'* b@it-in F@nctionThe #inary #uilt?in function )N(I$A+ or N(I$* interprets the contents of a specied

    5 character aria#le as a signed #inary integer. The synta' of the #inary #uilt?infunction is-N(I$ )character?aria#le?name starting?position length*The starting position and length are optional. +ou can use the #inary #uilt?in functionwith #oth the I3 and 61

  • 7/26/2019 Tips 'n' facts.doc

    32/39

    Tips n Facts

    sing t>e :S;T b@it-in F@nctionThe switch #uilt?in function )NS;IT6* compares one or more of eight switches withthe eight switch settings already esta#lished for the !o# and returns a logical alue ofQ0Q or QDQ. The initial alues of the switches for the !o# are determined rst #y thereate Bo# escription )TB%(* commandR the default alue is 00000000. +ou can

    change this if necessary using the S;S parameter on the S(B%(, 61B%(, or B%(command. %ther high?leel languages may also set !o# switches.If, in the comparison of your NS;IT6 alues against the !o# alues, eery switch isthe same, a logical alue of QDQ )true* is returned. If any switch tested does not haethe alue indicated, the result is a Q0Q )false*. The synta' of the NS;IT6 #uilt?infunction is-

    NS;IT6 )=?character?mas"*The =?character mas" is used to indicate which !o# switches are to #e tested, andwhat alue each switch is to #e tested for. 2ach position in the mas" correspondswith one of the eight !o# switches in a !o#. osition D corresponds with !o# switch D,position E with switch E, and so on. 2ach position in the mas" can #e specied as oneof three alues- 0, D, or 8.0 The corresponding !o# switch is to #e tested for a 0 )oP*.D The corresponding !o# switch is to #e tested for a D )on*.8 The corresponding !o# switch is not to #e tested. The alue in the switch doesnot aPect the result of NS;IT6.If NS;IT6 )08DDD880* is specied, !o# switches D and = are tested for 0sR switchesF, 4, and are tested for DsR and switches E, K, and 7 are not tested. If each !o#switch contains the alue )D or 0 only* shown in the mas", the result of NS;IT6 istrue QDQ.

    %n the I3 command, NS;IT6 can #e specied on the %$ parameter as thelogical e'pression to #e tested. In the following e'ample, 08DDD880 is compared tothe predetermined !o# switch setting- I3 %$)NS;IT6)08DDD880** T62$)1%T%*If !o# switches D, F, 4, , and = contain 0, D, D, D, and 0, respectiely, the result istrue and the procedure #ranches to the command haing the la#el . If one or moreof the switches tested do not hae the alues indicated in the mas", the result isfalse, and the #ranch does not occur.

    %n the 61515 61

  • 7/26/2019 Tips 'n' facts.doc

    33/39

    Tips n Facts

    2$1Then the aria#le JA has a alue of QDQ.

    - 33 -

  • 7/26/2019 Tips 'n' facts.doc

    34/39

    Tips n Facts

    AppenCiH F - ,ata @e@es

    - ata queues are a type of system o#!ect that you can create to which one 655program can send data. They are the fastest means of asynchronouscommunication #etween two !o#s. To receie and send data to : has fewer

    oerheads than using data#ase les, message queues or data areas. They shouldnot #e used for storing large olumes of data and for long term storage of data.They are similar to message queues in that programs can send and receie datafrom them. ;hile only one program can hae receie pending on a messagequeue more than one program can hae a receie pending on a message queueat the same time.

    To cear a Cata ?@e@e

    15 6A* 52$)D0*

  • 7/26/2019 Tips 'n' facts.doc

    35/39

    Tips n Facts

    J:$A2 is D0?length character eld that names the data queue.

    J5I( is D0?length character eld that names the li#rary containing data queue.

    J3552$ is ?digit pac"ed decimal aria#le, which species the num#er of characterssent to/receied from the data queue.

    J3I25 is a character eld of length equal to the alue in J3552$.

    J2+52$ is a F?digit pac"ed decimal aria#le, which species the length of the "eysent to/receied from the data queue.

    J2+ is a character eld of length equal to the alue in J2+52$.

    J;AIT is a ?digit pac"ed decimal aria#le, which waits for the time specied in thisaria#le if there are no entries in the data queue.

    J%2 is a E?length character eld that retriees a message using the speciedcharacter "ey li"e 1T- or 5T- or $2- etc

    JS$52$ is a F?digit pac"ed decimal eld that sends the length of the senderidentication parameter. It must #e &ero or equal to or greater than =.

    JS$ is a character eld that identies the aria#le to contain the senderidentication information associated with the receied message.

    AppenCiH - ,ata area

    - A local data area cannot #e created, deleted or allocated.

    - A local data area can not #e referred to from any other !o#. %ther programs within same!o# can refer it.

    - A rogram Initiali&ation arameter data area )I* is created for each pre?start !o#when the !o# is started. The si&e of A is E000 #ytes #ut the num#er ofparameters contained in it is not restricted.

    - A data area is an o#!ect used to hold data for access #y any !o# running on thesystem. It can #e used to store information of limited si&e, independent of thee'istence of programs and les.

    - A local data area )>5A* is created for each !o# in the system with a length ofD0E4 and type >6A. It can not #e referred to from any other !o#. It can not #ecreated, deleted or allocated. $o li#rary is associated with it.

    - The contents of the su#mitting !o#Ms 5A is copied in to su#mitted !o#Ms 5A.6ence, the contents of 5A e'ist across routing step #oundaries.

    - A group data area )>1A* is created when an interactie !o# #ecomes a group !o#with a length of DE and type >6A. It can not #e referred to from #y !o#soutside the group. It can not #e created, deleted or allocated. $o li#rary isassociated with it.

    - 35 -

  • 7/26/2019 Tips 'n' facts.doc

    36/39

    Tips n Facts

    AppenCiH - S% oors anC Attrib@tes

    - +ou need to em#ed the he' alue for the display attri#ute )highlight, #lin",underline, color, etc.* directly in the source statement to achiee this.

    - reate a mem#er #y name S293T%2 of type T28T in source physical le

    :152S.- o the following oerride and compile interactiely the S29%2S program oftype 152-

    %

    $ormal s D In&)'QE0Q* I s D In&)'QEDQ* 6I s D In&)'QEEQ* I^6I s D In&)'QEFQ* 95 s D In&)'QE4Q* I^95 s D In&)'QEQ* 6I^95 s D In&)'QEKQ* $ s D In&)'QE7Q* (5 s D In&)'QE=Q* I^(5 s D In&)'QE@Q*> eal STA V Q Q G I G Q IQ write S293T%2 eal STA V Q Q G 6I G Q 6IQ write S293T%2 eal STA V Q Q G I^6I G Q I^6IQ write S293T%2 eal STA V Q Q G 95 G Q 95Q write S293T%2 eal STA V Q Q G I^95 G Q I^95Q write S293T%2 eal STA V Q Q G 6I^95 G Q 6I^95Q

    write S293T%2 eal STA V Q $on?display ne'tQ write S293T%2 eal STA V Q Q G $ G Q $Q write S293T%2

    eal STA V Q Q G (5 G Q (5Q write S293T%2 eal STA V Q Q G I^(5 G Q I^(5Q

    write S293T%2 eal >inlr V >on>

    - 36 -

  • 7/26/2019 Tips 'n' facts.doc

    37/39

    Tips n Facts

    AppenCiH - Seecting 'ecorCs sing t>e O"$'*F ommanCIn all of the following e'amples, it is assumed that a single?format data#ase le)physical or logical* is #eing processed. )The 3I52 parameter on the %$:+3

    command allows you to specify a record format name if the le is a multiple formatlogical le.*To re?@est a seection against a c>aracter constant

    %$:+3 3I52)3I52A* :+S5T)Q%2 >2: OO Q*

    To re?@est a seection against a n@meric constant%$:+3 3I52)3I52A* :+S5T)QAT >1T D000.00Q*

    ;>en comparing a c>arcter EeC Ga@e to a ! Gariabe

    %$:+3 3I52)3I52A* :+S5T)QOQ >AT J6A >AT QO >2: 3I25AQ*$otice that apostrophes and quotation mar"s enclose the 5 aria#les and >AToperators. )only character 5 aria#les can #e used*

    ;>en comparing a n@meric EeC Ga@e to a ! Gariabe%$:+3 3I52)3I52A* :+S5T)J6A$9 >AT Q >2: $9Q*

    $otice that apostrophes enclose the eld and operator only. )only character 5aria#les can #e used*Seecting recorCs @sing t>e contains #@nctionTo process all records in which the Addr eld contains the street named (%A;A+you can specify-

    %$:+3 3I52)3I52A* :+S5T)QA >T O(%A;A+O Q*

    apping EeCs #or packeC n@meric Cata EeCsIn this e'ample, if AT2 was a date data type, it could #e specied as follows-

    %$:+3 3I52)3I52A* :+S5T )Q+2A >2: ==Q* A35))+2A QN+2A)AT2*Q**$ote- apped eld denitions are always processed #efore the :+S5T parameter isealuated.+ou could accomplish the same result #y specifying the su#string on the :+S5Tparameter and dropping one of the mapped eld denitions as follows-

    %$:+3 3I52)3I52A* G :+S5T)QNSST)6AK E* >2: O==O Q* G A35))6AK QNI1ITS)AT2*Q**

    sing t>e DiCcarC #@nction+ou would not select the other records #ecause a comparison is made with #lan"sadded to the alue you specied. The way to select all four names is to specify-

    :+S5T)Q$A2 >2: N;5)OB%6$S>O*Q*

    - 37 -

  • 7/26/2019 Tips 'n' facts.doc

    38/39

    Tips n Facts

    AppenCiH 9 - ser ,eEneC ommanCsThe AS/400 control program lets users dene a command that calls a program toperform some function. 9sers can dene commands #y using a command denitionstatement.

    ommanC StatementsThe command denition statement of each command contains one or more of thefollowing command statements-- )ommand* ? Species the prompt te't for the command )%nly one

    statement*- 2 )ependent* ? enes the relationship among parameters- 252 )2lement* ? enes an element in a list used as a parameter alue )A

    ma'imum of F00 statements*- A )arameter* ? enes a parameter or "ey parameter for a command )A

    ma'imum 7 F00 statements*- TT5 )rompt ontrol* ? enes conditions under which certain parameters are

    prompted- :9A5 ):ualier* ? enes a qualier of a name used as a parameter )A ma'imum

    of F00 statements*

    ommanC "rocessing "rogramThe command processing program )* is the program that the command analy&ercalls to perform the function requested. The can #e a 5 program, another 655program. The must accept the parameters as dened #y the command denitionstatements. A command processing program is mandatory.

    VaiCitB >ecking programTo ensure that the alid alues are entered for the required parameters, +ou maywrite your own alidity chec"ing program. A

  • 7/26/2019 Tips 'n' facts.doc

    39/39

    Tips n Facts

    The code for the ommand rogram );*

    %T)Q;% ;IT6 2(2S 9SI$1 Q*

    A ;)3I52* T+2)>$A2* 52$)D0* %T)Q3ileQ*A ;)5I(* T+2)>$A2* 52$)D0* %T)Q5i#raryQ*

    The code for ommand rocessing rogram );*

    1 A)J3ile J5i#rary*5 6A* 52$)D0*5 6A* 52$)D0*;( 3I52)J5I(A+/J3I52*2$1

    The code for ommand IA1*S$1S1 S1I)3000E* S13):3S1* S1T+2)>2SA2*2$%

    /> hec" for the e'istence of Source 3ile in the specied 5i#rary >/

    6%(B %(B)J5I(A+/J3I52* %(BT+2)>3I52*%$S1 S1I)30000* 282)%*

    S$1S1 S1I)000K* S13):3S1* S1TA)Q0000 G3ile . . does not e'ist in specied G5i#rary.Q* S1T+2)>IA1*

    S$1S1 S1I)3000E* S13):3S1* S1T+2)>2SA2* 2$%

    2$1