Ans: Application system.
Ans: OS/400 Version 4, introduced a feature LPAR (Logical PARtitioning) which facilitates running multiple operating systems simultaneously on one IBM System i unit ensuring that one OS doesn’t interfere other’s system resources/memory.
Ans: When we execute a command or call a program, the AS/400 must know where to find the command or program and the answer is library. A Library is a collection of objects. QSYS is the only library that contains other library. QSYS is the root library where the entire user defined/ system defined library is created. System supplied libraries begin with the letter "Q" or "#".
Library list types:
System library: All IBM supplied library e.g. QSYS, QHLPSYS, QUSRSYS…
Product Library: Whenever Ibm product is used it is added to the library automatically and is removed itself when the job completes.
Current Library: Current library is the working library i.e. all the work done by you is stored in current library.
User Library: Non-IBM supplied i.e. created by the user.
Ans: QSYS
Ans: It’s a user library.
Ans: By using the command DSPLIB.
Example: DSPLIB IROBO1
It gives you the information of all objects that resides in the library with it size.
Display Library
Library . . . . . . : IROBO1 Number of objects . : 8
Type . . . . . . . . : PROD Library ASP number . : 1
Create authority . . : *EXCLUDE Library ASP device . : *SYSBAS
Type options, press Enter.
5=Display full attributes 8=Display service attributes
Opt Object Type Attribute Size Text
PRINT1PGM *PGM RPGLE 131072 rpgle program for pri
ACCOUNT *FILE PF 49152 ACCOUNT RELATED INFOR
PRINT1 *FILE PRTF 4096 PRINTER DDS RLU GENER
QCLSRC *FILE PF 8192 Sources CL-Programs
QDDSSRC *FILE PF 8192 DDS-Sourcen
QRPGLESRC *FILE PF 69632
QRPGLESRC2 *FILE PF 65536
QRPGSRC *FILE PF 8192 SOURCE PHYSICAL FILE
Bottom
F3=Exit F12=Cancel F17=Top F18=Bottom
Ans: Source physical file is a file which contains the sources of different types of objects. There can be up to 32768 members. Source physical file is an object. But the source member is not an object. When we compile the member, the object is created for that source. Command used is CRTSRCPF.
CRTSRCPF FILE(IROBO1/QRPGSRC) RCDLEN(112) TEXT('SOURCE PHYSICAL FILE’)
Ans: By using the command shown below:
DSPFD FILE(IROBO1/QRPGLESRC) TYPE(*MBRLIST)
Ans: By using the command shown below:
DSPFD FILE(IROBO1/QRPGLESRC) TYPE(*RCDFMT)
Ans: By using the command below:
CHGPF FILE(AMITNEM/OBJ) SRCFILE(AMINEM/QDDSSRC) SRCMBR(OBJ_SRC)
We change the highlighted part to change the size of a file.
Change Physical File (CHGPF)
Type choices, press Enter.
Physical file . . . . . . . . . Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
System . . . . . . . . . . . . . *LCL *LCL, *RMT, *FILETYPE
Source file . . . . . . . . . . *NONE Name, *NONE
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Member size:
Initial number of records . . *SAME 1-2147483646, *NOMAX, *SAME
Increment number of records . *SAME 0-32767, *SAME
Maximum increments . . . . . . *SAME 0-32767, *SAME
Ans: For this we will use file level keywords FIFO/LIFO/FCFO in the physical file.
FIFO: The duplicate key records will retrieved in first in first out order.
LIFO: The duplicate key records will retrieved in last in first out order.
FCFO: The duplicate key records will retrieved in first changed first out order.
Ans: below is an example, we are going to use the file REFER to get the field definition for new file.
USE OF REFERENCE
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> REFER
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R REF
0003.00 A RAC1 2P 0 COLHDG('LEVEL ID')
0004.00 A RAC2 3P 0 COLHDG('ORG CODE')
0005.00 A RAC3 12P 0 COLHDG('ACCOUNT NUM')
0006.00 A RAC4 3A COLHDG('ACCOUNT CURRENCY')
0007.00 A RPOSTCODE 2P 0 COLHDG('POST CODE')
0008.00 A RCOUNTRY 3P 0 COLHDG('COUNTRY CODE')
0009.00 A RNAME 20A COLHDG('NAME')
0010.00 A RDATE 3P 0 COLHDG('DATE')
****************** End of data ****************************************
Now we can refer the file ‘REFER’ to take the field definition in the new file.
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> USEREF
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A REF(REFER)
0003.00 A R USEREF
0004.00 A ACCLVL R REFFLD(RAC1 REFER) >>>>>> field name and
0005.00 ALIAS(ACC_LVL_ID) referred file name
0007.00 A ACCORG R REFFLD(RAC2 REFER)
0008.00 ALIAS(ACC_ORG_CODE)
0009.00 A ACCNUM R REFFLD(RAC3 REFER)
0010.00 ALIAS(ACC_NUM)
0011.00 A ACCCUR R REFFLD(RAC4 REFER)
0012.00 ALIAS(ACC_CUR)
0013.00 A ACCNAME R REFFLD(RNAME REFER)
0014.00 ALIAS(ACC_NAME)
****************** End of data ****************************************
Ans: It depends on the value that we have set for LVLCHK (Record format level check) attribute. If its value is *YES then the record format level identifier is checked when the file is opened and if it doesn’t match it throws the error. If its value is *NO, then the record format level identifier is not checked, hence no error.
Ans: Logical file
Ans: Logical file
Ü Types of Logical file
There are two types:
1) Non-join logical file
2) Join logical file
1) Non-join logical file
Non-join logical files can either be a simple logical file, which contains only one record format or a multiple record format logical file, which contains more than one Record format.
Logical files can be derived from 1 to 32 physical files and so a logical file can have a maximum of 32 record formats.
i) Single record format Non-join logical file:
If a logical file is derived from single physical file it is called simple logical file.
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> MULTIFRMT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R ACCOUNT PFILE(AMINEM/ACCOUNT)
0003.00 A K ACCOUNTNUM
0005.00 A K ACCURRENCY
ü) Multiple record format Non-join logical file:
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> MULTIFRMT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R ACCOUNT PFILE(AMINEM/ACCOUNT)
0003.00 A K ACCOUNTNUM
0005.00 A K ACCURRENCY
0006.00 A R TRANS PFILE(AMINEM/TRANS)
0007.00 A K TACCOUNT
0008.00 A K TCURRENCY
****************** End of data ****************************************
Ans: DYNSLT: Use this file-level keyword to indicate that the selection and omission tests specified in the file (using select/omit specifications) are done at processing time. This keyword specifies dynamic select/omit rather than access path select/omit.
Only a Physical file contains data. Logical files just contain pointers for processing the data in a specific sequence and/or subset of data.
When a record is added/changed/deleted in a physical file, the system has to put a lock on it and then go out to check and update any logical files before it can release the lock. While the amount of time to do this is hardly measurable, it can be significant if massive batch updates are done to a file.
If you are using the Select/Omit option in your DDS and using DYNSLT, the above process does not need to be done at record update time.
Where this is beneficial is when your selection process includes almost all the records in the file. Now when you process using DYNSLT, it will read all the records in the file, but do the selection of which records to process at that time rather than having done all the maintenance ahead of time.
Ans: Dynamic select occurs whenever the program reads file. But access path occurs before the file is read (but not necessarily).
Ans: JDUPSEQ
This join–level keyword is used to specify the order in which records with duplicate join fields are presented when the JLF is read.
The format for this keyword is:
JDUPSEQ (Sequencing field-name [*DESCEND])
i) This keyword has no effect on the ordering of records with unique keys.
ü)If *DESCEND is not specified then the default is sequencing in ascending order.
Bottom of Form
Ans: JDFTVAL
Ans:
Non join logical file | Join logical file |
We can insert or delete or update records using non-logical file. | Insertion, updating or deletion of records is not possible in join logical files. |
DFU can be used to display non-join logical file. | DFU is not available |
1-32 record format is specified | Only one record format can be specified |
Commitment control is used | Commitment control cannot be used. |
[teaserbox type="4" img="2803" title="Interested in Learning Devops" subtitle="Join Us now!" link_url="http://www.mytectra.com/devops-training-in-bangalore.html" target="blank"]
Ans:
Physical file | Logical file |
1. Occupies the portion of memory. It’s containing data. | Does not occupy any memory space. Does not contain any data. |
2. A physical file contains one record format | A logical file can contain up to 32 record formats. |
3.Can be exist even without LF | Can’t exist without PF |
4. If you delete a LF, the PF can’t be deleted | If you delete a LF, the PF can’t be deleted |
5.CRTPF command is used to create such object | CRTLF command is used to create such type object |
Ans: Record format field mapping (FMT)
*MAP
Fields with the same name in the from-file and to-file record formats are copied, and any fields in the to-file that do not exist in the from-file format are set to the default value specified on the DFT keyword for the data description specification (DDS) of the to-file or zero for numeric fields, blanks for character fields, current date/time for date/time fields, or null value for null-capable fields.
If *MAP is specified, *DROP can also be specified.
*DROP
This value must be specified for field-level mapping if any of the field names in the from-file record format do not exist in the to-file format. If *DROP is specified, *MAP can also be specified. When *DROP is specified, all the field names that exist in both record formats must have the same attributes and relative positions in the from-file and to-file record formats, or *MAP must also be specified. Null values are copied.
*NOCHK
If the record formats of the database files are different, the copy operation continues despite the differences. Record data is copied directly (left to right) from one file to the other. FMTOPT (*NOCHK) is required when copying all record formats from a logical file with multiple formats (when RCDFMT (*ALL) is specified) to a physical file that is of the same type (source or data) as the from-file.
*CVTSRC
This value is used to copy between database files, from a source file to a data file, or from a data file to a source file. It is valid only when the from-file and to-file are different types (source and data).
Ans: In CRTDUPOBJ for a logical file the created duplicate file will be also logical file and for a physical file the created file will also be a physical file. Even the record format identifier will also be the same. While in case of COPYF, if we are copying a logical file then the created file be a physical file not a logical file.
Ans:
Access path
i) Access path describes the order in which records are to be read.
ii) Access paths can be kept on the system permanently (such as physical or logical file) or temporarily.
üi) OPNQRYF command may create a temporary access path for use one time, and then discard the access path.
Ans: Types of Access Path
i) Sequentially, where each record is taken from the next sequential physical position in the file.
ü)Directly by relative records number, where the record number is identified by its position from the start of the file.
i) It is based on the contents of the key fields as defined in DDS. This type of access path is updated in the contents of a key field is changed.
ü) There are three ways of bounding the access path:
Immediate
Rebuild
Delayed
Ans: If you do not specify the type of maintenance for a file, the default is immediate maintenance.
Ans: Maximum no of fields included in a PF is 8000.
Ans: Maximum no of parameter passed in RPG is 255.
Ans: Maximum no of parameter passed in CL is 40.
Ans: Compile time array
DIM() represents the size of the array.
CTDATA() represents that it is compile time array.
PERRCD() represents the number of entries in one array record.
Dim = row i* col j
e.g. PERRCD=2, NO. OF ROWS=3, THEN DIM = PERRCD*NO. OF ROWS=6
[teaserbox type="4" img="2802" title="Interested IN Learning Hadoop through Experts!" subtitle="We are There to lead You... to Excellence..." link_url="http://www.mytectra.com/hadoop-training-in-bangalore.html" target="blank"]
Ans: Array is collection of elements of same data type.
Types of Array
1) Compile time array
2) Pre-runtime array
3) Run time array
Ans: Pre-runtime array
length of record = Perrcd *size of 1 element
Ans: DATA STRUCTURE
Ans: Below are the types of data structures in as/400:
Ans: A program status data structure (PSDS) can be defined to make program exception/error information available to the program so that the necessary action can be taken for the unhandled exception. The exception /errors can beDivide by zero, array index out-of-bound, Invalid Date, Time or Timestamp value. The PSDS must be defined in the main source section; therefore, there is only one PSDS per module.
Ans: A file information data structure (INFDS) can be defined for each file to make file exception/error and file feedback information available to the program.
Ans: Steps of creating the subsystem
i)Create Subsystem description (CRTSBSD)
First of all we create subsystem description as below:
CRTSBSD SBSD (AMINEM/MYSBSD) POOLS ((2 *BASE)) MAXJOBS(2) TEXT('My subsystem description')
ii)Create Job queue (CRTJOBQ)
Then we create a job queue as below:
CRTJOBQ JOBQ (AMINEM/MYJOBQ) TEXT('My job queue')
iii)Add Job Queue Entry (ADDJOBQE)
Once the job queue is created, then we attach the (ADDJOBQE) command, as follows:
ADDJOBQE SBSD (AMINEM/MYSBSD) JOBQ (AMINEM/MYJOBQ) MAXACT (1)
MAXACT denotes the number of the jobs that can be process at the same time.
iv)Create Class (CRTCLS)
Class defines the run time attribute e.g. Run priority, Time slice, Default wait time, Maximum temporary storage etc.
CRTCLS CLS(AMINEM/MYCLS) RUNPTY(40)
v)Add Routing Entry (ADDRTGE)
ADDRTGE SBSD(AMINEM/MYSBSD) SEQNBR(9999) CMPVAL(*ANY) PGM(SYS/QCMD) CLS(AMINEM/MYCLS)
vi) Start Subsystem (STRSBS)
STRSBS SBSD(AMINEM/MYSBSD)
Ans: Compiler directive
(1) /FREE... /END-FREE
(2) /TITLE
(3) /EJECT
(4) /SPACE
(5) /COPY or /INCLUDE
(6) /IF……/ELSEIF…. /ELSE…… /ENDIF
(7) /EOF
Ans: Data Queue
By using this command sent data same / another program.
QSNDDTAQ PARM (QUEUE-NAME LIB &LEN &DAT)
By using this command receive data same /another program
QRCVDTAQ PARM (QUEUE-NAME LIB &LEN &DAT &WAIT)
Ans: We are using FTP in as400 to send and receive data from/to remote system.
Below are the basic FTP commands in the transfer:
e.g.
LCD Library-name
LCD C:\folder\onpc\where\stuffis
LCD “C:\Program Files”
e.g.
CD Library-name
CD C:\folder\onpc\where\stuffis
CD “C:\Program Files”
e.g.
GET AMINEM/QRPGLESRC.DSPPGM
This can be used to fetch save-file also:
GET SAV005
If Member SAV005 in file SAV005 in library QGPL already exists. Specify
REPLACE as a subcommand option as shown below.
GET SAV005 (REPLACE
e.g.
MGET aminem.* aminem1.*
e.g.
PUT RPGSRC.ADDCL RPGSRC11.ADDCL1
It is used to fetch multiple file from remote system, GENERIC IS ALLOWED.
e.g.
MGET aminem.* aminem1.*
i) For working with standard library objects
ü) File identifiers have three components: Library, File and member.
üi) Library and file components are separated by the / delimiter.
iv)File and member components are separated by the . delimiter.
v)Syntax: Library/file.member
Example
PUT something.txt QGPL/QCLSRC.TEST
CD QGPL
PUT something.txt QCLSRC.TEST
i)For working with IFS objects (ie. All objects)
ü) Directory levels separated by the / delimiter.
üi)Database files use format: /QSYS.lib/Libname.lib/Fname.file/Mname.mbr
iv)Documents (files) stored in folders use format: /QDLS/folder/document.ext
v)CD / (puts you in the root IFS folder)
Ends the FTP session with the remote computer and exits ftp.
Ends the FTP session with the remote computer and exits ftp.
i) It Sets the file transfer mode to ASCII (Note: this is the default mode for most FTP programs)
ü)ASCII is a character-encoding scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters.
e.g.
ftp> ascii
ftp> put d:\path1\filename1.txt
200 PORT command successful.
Opening ASCII mode data connection for filename1.txt
226 Transfer complete
i) It Sets the file transfer mode to Binary
ü) the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files or non-standard files e.g. zip file, tar file, image file, .DAT file, save file, executable files, sound files, graphic files etc.
e.g.
ftp> binary
ftp> put d:\path1\filename1.zip
200 PORT command successful.
Opening BINARY mode data connection for filename1.zip
It will send an argument to the remote FTP Server. This statement is similar in purpose as the "LITERAL" statement.
This parameter is used at the client system to transfer a function (via the LITERAL or QUOTE statement) to the host site.
e.g.
We can change the naming format to 0 with the command as shown below.
It opens a new FTP connection with another system.
e.g.
Open system-name[teaserbox type="5" img="2803" title="Interested in Learning IOT" subtitle="Join myTectra" link_url="http://www.mytectra.com/iot-training-in-bangalore.html" target="blank"]
Ans: APYJRNCHG: Uses the journal entries to apply changes that have occurred since a database file was saved or some other specified time.
CHGJRN: Use this command to change the attributes of a journal or to attach new journal receivers to a journal.
CMPJRNIMG: This command compares and lists the difference between the before-image and after-image of a record, or between the current after-image of a record and the previous after-image of the record.
CRTJRN: Use this command to create a journal.
CRTJRNRCV: Use this command to create a journal receiver.
DLTJRN: Use this command to delete a journal.
DLTJRNRCV: Use this command to delete a journal receiver.
DSPJRN: This command displays or prints the journal entries that are in the journal receivers associated with the specified journal. This command has outfile support so you can list the journal entries to a database output file for further processing or analysis.
DSPJRNRCVA: Use this command to display the attributes of a journal receiver.
ENDJRNPF: This command ends journaling for the specified physical file.
RCVJRNE: This command allows a specified user program to continuously receive journal entries one at a time as they are written to the journal. The behavior is similar to an exit program.
RMVJRNCHG: Use this command to remove changes that have occurred to a database file from a specified point in time to some previous point in time (allowed only if before-images were recorded during the time).
RTVJRNE: Use this command to retrieve a journal entry and place it in CL program variables.
SNDJRNE: Use this command to write user-defined entries to a journal (i.e., journal receiver).
STRJRNPF: Use this command to start journaling for the physical file.
WRKJRN: This command displays a menu from which you can perform many journal-related functions, such as system-assisted recovery of journaled files.
WRKJRNA: This command displays the attributes of a journal and the associated receivers.