Search This Blog
Thursday, January 21, 2010
Configuring Network Printer
2. CRTDEVPRT DEVD(NLDACCT) DEVCLS(*LAN) TYPE(3812) MODEL(1) + LANATTACH(*IP) PORT(9100) ATTACH(*DIRECT) ONLINE(*YES) +
FONT(011 *NONE) FORMFEED(*AUTOCUT) SEPDRAWER(*FILE) +
PRTERRMSG(*INQ) MSGQ(*CTLD) ACTTMR(600) INACTTMR(*SEC15) +
LINESPEED(19200) WORDLEN(8) PARITY(*NONE) STOPBITS(1) +
TRANSFORM(*YES) MFRTYPMDL(*HP4000) PPRSRC1(*LETTER) +
PPRSRC2(*LETTER) ENVELOPE(*NUMBER10) ASCII899(*YES) +
IMGCFG(*NONE) CHRID(*SYSVAL) RMTLOCNAME('10.112.153.73’) + SYSDRVPGM(*HPPJLDRV)
3 WRKDEVD -Take option 8 to vary on the printer
4 STRPRTWTR
All Interview questions AS400
Simply type WRKACTJOB and type option 5 against QCTL subsystem and type option 1 "Display job status attribute and look for Entered system Date and time
I'm running a weekly backup to save all my data, as there is no one on site to run the go save options. What is the best way to recover my data?
If you are using the weekly backup function of the Go Backup menu, you will need to use the individual system restore commands like Restore User Profiles (RSTUSRPRF), Restore Configuration (RSTCFG), Restore Library (RSTLIB), Restore Document Library Objects (RSTDLO) and Restore Object (RST) to recover your system.
How many users are logged into your system?
1. Enter command WRKSYSSTS (Display System Status) on command line. 2. Use function key F21 to set the value for "Assistance Level" to 1=Basic.
3. On line number 9 the number of signed on users is displayed.
SAVLIB LIB(*ALLUSR) STG(*KEEP) …This will be your backup in case a media error is encountered. You can make two backups to be doubly safe.
SAVLIB LIB(*ALLUSR) STG(*FREE) ... This deletes and frees the storage for all user libraries and the objects they contain.
RSTLIB SAVLIB(*ALLUSR) ... This restores the libraries and objects while distributing the data evenly.
Find out which IP interface a device is connected to
To find out the network interface a specific device is using to access your iSeries server, proceed as follows:
1. Enter command NETSTAT
2. Choose option ". Work with TCP/IP connection status"
3. Use function key F11 twice to see the "Local Address" column
Restarting QINTER over network
- The FTP server must be running. - The profile must have sufficient authority within the system to start QINTER. - The user must have the ability to use the command line.
Take care -- there may be a good reason why QINTER may be down in the first place - to ensure there's no prospect of interactive jobs locking any objects on the system.
FTP hostname user-d password QUOTE RCMD STRSBS SBSD(QINTER)
QUIT
Is there an easy way to run a command on another iSeries from the iSeries where I am signed in?
A: You can use DDM, but it is a bit complex. The easiest way is to use is the Run Remote Command (RUNRMTCMD) command. Most of us think of it as just a way to run a PC command from the iSeries, but it also works when you direct it to another iSeries system. All you need is a TPC/IP connection, not any type of session or DDM file, so it is good for "spur-of-the-moment" use. If the command returns output, it will be put in a spooled file on the issuing system. RUNRMTCMD can be run from the command line or placed in a CL program.
For example, the following would execute the DSPSYSVAL QSRLNBR on another system and put the serial number in a spooled file.
RunRmtCmd CMD('DSPSYSVAL QSRLNBR') +
RMTLOCNAME(system_name *IP) RMTUSER(my_user_ID) +
RMTPWD(my_password)
The connection can be TCP/IP (*IP after the system name, as shown here) or SNADS (*SNA).
Can I create more TCP/IP Telnet server ports on the iSeries?
A: Yes, key in the command WRKSRVTBLE. While in this screen, you will be able to add all the Service Table Entries with a corresponding Port and Protocol that you want to use for the Telnet Port.
See WRKSRVTBLE (Work with Service Table Entry) Command Description for more information.
Is it possible to allow case-sensitive passwords on the iSeries?
A: V5R1 allows the use of case-sensitive passwords for user profiles, although you will need to alter the setting of the QPWDLVL (password level) system value. To learn more about QPWDLVL,
How to send email from iSeries
Use the SNDDST command to send the message.
Example:SNDDST TYPE(*LMSG) TOINTNET((someone@SomeDomain.com) (someoneelse@hotmail.com *PRI)) DSTD(Here is your file!!) LONGMSG(Your test worked great!. Please call me if you have questions/comments. )
II. Send a file as an attachmentThe file must exist in the QDLS directory structure. You need to know the name of the file.You will need to know the internet address(es) of the recipient(s). Use the SNDDST command to send the message.
:SNDDST TYPE(*DOC) TOINTNET((someone@SomeDomain.com *PRI) (someoneelse@hotmail.com *PRI)) DSTD(Here is your file!!) MSG(File TESTMAIL.txt attached) SNDFMT(*NOCHG) DOC(TESTMAIL.TXT) FLR(PCUPLOAD)
This is used when sending mail as well as receiving it. Type the following
CHGSMTPA AUTOSTART(*YES) MAILROUTER('your.isp.smtp.server') FIREWALL(*YES) ALWRLY(*BOTH)* AUTOSTART(*YES) tells the system you want this server to start automatically when TCP/IP is started.
CHGPOPA MSGSPLIT(*NOMAX)
ADDSMTPLE TYPE(*ACCEPT) INTNETADR('192.168.5.0') SUBNETMASK('255.255.255.0')
ADDDIRE USRID(INTERNET GATEWAY) +USRD(‘Internet SMTP gateway’)
SYSNAME(INTERNET) +PREFADR(NETUSRID *IBM ATCONTXT)CHGDSTA SMTPRTE(INTERNET GATEWAY)
STRTCPSVR SERVER(*SMTP)(If it was already running, use ENDTCPSVR to end it. Then use WRKACTJOB SBS(QSYSWRK) to make sure that all of the QTSMTPxxxx jobs end, then use STRTCPSVR to start it up again.)Each user who needs to send e-mail using SNDDST will need to have a directory entry and SMTP e-mail address configured on the iSeries
.ADDDIRE USRID(KLEMSCOT S10262BA) USRD('Scott Klement')
WRKNAMSMTP TBLTYPE(*SYSTEM)1. Use option 1=Add2. Type the same name/address that you used on the ADDDIRE command3. Enter the SMTP e-mail address for this user.Once all of that is done, it should be easy to send off a test e-mail with SNDDST.
SNDDST TYPE(*LMSG) +TOINTNET(('unclebob@example.com')) +DSTD('Put E-mail Subject Here') +LONGMSG('Hi Bob. This is an E-mail message sent from my iSeries system.')
Check and recover damaged objects
1. Display the QHST (history) log by typing DSPLOG and pressing F4 (Prompt).
2. On the prompt display, fill in a starting date and time to limit the number of entries you see.
3. On the display, fill in *PRINT for the Output prompt and press the Enter key.
4. Type: WRKSPLF. You are shown a list of spooled files for your job.
5. Locate the spooled file for the DSPLOG command. Use option 3 to hold the spooled file.
6. Use option 5 to display the spooled file.
7. Look for entries for damaged objects and files that are not synchronized. You can use the Find function to search for lines that have these character strings: damage and sync. Following are some examples of messages you might see:
CPF3113 Member damaged
CPF3175 File is not synchronized
CPF3176 Data space is partially damaged
CPF3171 Journal is damaged
CPF3172 Objects are not synchronized with the journal
CPF3173 Journal receiver is damaged
CPF3174 Journal receiver is partially damaged
CPF81xx General messages about object damage
8. Write down the names and types of the objects you find. Consult the table below for the correct recovery procedure, based on the type of object that is damaged.
Type of Object -
Operating system object in QSYS library Advice - Contact software support for assistance. You may need to install the operating system again.
Type of object - IBM-supplied user profile. Advice - Perform an abbreviated installation of the operating system.
Type of object - Job description that is specified on the workstation entry for the console in the controlling subsystem. Advice - If no other workstation entries exist for the controlling subsystem, the system is not useable. Contact software support for assistance.
Type of object - Job queue Advice - Perform an IPL. Restore or re-create the damaged job queue. All entries are lost.
Type of object - Output queue Advice - Perform an IPL. If the output queue is the default output queue for a printer, it is re-created and it's entries are rebuilt. Other output queues must be restored or re-created. Their entries are not recovered.
Type of object - Damaged file whose name starts with QAOSS* Advice - Delete the file. Restore it from a backup copy. Run the RCLDLO DLO(*DOCDTL) command.
Type of object - Database file Advice - Performing a special IPL during which the system analyzes every disk segment for parts of database objects can recover some types of object-level damage to database files. Following are examples of object-level damage:
Lost pointers between the index (access path) and the data.
Unidentified objects on the object recovery list.
If you are experiencing problems with database files, you can display the Licensed Internal Code log to determine whether a special IPL may resolve the problems.
Note: You must have *SERVICE special authority to perform the tasks that are described in this topic.
Do the following:
1. Type STRSST and press the Enter key. You are shown the System Service Tools (SST) menu. 2. Select option 1 (Start a service tool). You are shown the Start a Service Tool display.
3. Select option 5 (Licensed Internal Code log). You are shown the Licensed Internal Code Log display.
4. Select option 1 (Select entries from the Licensed Internal Code log). You are shown the Specify Licensed Internal Code Log Selection Values display.
5. Type 0600 for the Major code prompt.
6. Type 145F for the Minor code prompt.
7. For the starting date and time, enter values that approximate when you first started to have problems.
8.For the ending date and time, enter the current date and time.
9. Press the Enter key. If any errors have been recorded that may be resolved by a special IPL, you are shown a list of the entries. Otherwise, you receive a message that no log entries matched your criteria.
If you have log entries that suggest a special IPL, you need to schedule a time for this IPL. It may take many hours for the system to analyze all the disk segments. As a rough estimate, the analysis phase of the IPL will take approximately 1 second for each object on your system.
When you are ready to perform the IPL, do the following:
1. Place your system in a restricted state. See "Putting Your System in a Restricted State" in topic 3.1.4.
2. Type STRSST and press the Enter key. You are shown the System Service Tools (SST) menu.
3. Select option 1 (Start a service tool). You are shown the Start a Service Tool display.
4. Select option 4 (Display/Alter/Dump). You are shown the Display/Alter/Dump Output Device display.
5. Select option 1 (Display/Alter storage). You are shown the Select Data display.
6. Select option 5 (Starting address). You are shown the Specify Starting Address display.
7. Type 000000000E 000000 for the address and press the Enter key. You are shown the Display Storage display.
8. On the third data line (offset 0020), type 8 in the first character. Press F11 (Alter storage) to make the change take affect.
9. Press F3 until you return to the Exit System Service Tools display.
10. Press the Enter key (continue ending SST).
11. On the command line, type PWRDWNSYS OPTION(*IMMED) RESTART(*YES)
This causes the system to begin the special IPL.
Attention logical partitioning users! If you are going to use this command on the primary partition, be sure to power off all secondary partitions before running the command.
Type of object - Journal Advice - Note: The following steps only apply to recovering a damaged local journal.
Do the following:
1. Type WRKJRN.
2. On the prompt display, type the name of the journal. You are shown the Work with Journals display.
3. Select option 6 (Recover damaged journal).
4. Type: WRKJRNA JRN(library-name/journal-name) OUTPUT(*PRINT). You receive a listing that shows all the physical files and access paths that are currently being journaled.
5. Start journaling for any physical files that should be journaled but are not on the list by using the STRJRNPF command.
6. Start journaling for any access paths that should be journaled but are not on the list by using the STRJRNAP command.
7. If you previously had any remote journals that were associated with the damaged journal, add those remote journals again. You can add the remote journals by using the Add Remote Journal(QjoAddRemoteJournal) API or the Add Remote Journal (ADDRMTJRN) command.
8. Save each journal, physical file, and access path. You should always save files after you start journaling them.
Type of object - Journal receiver Advice - Note: The following steps only apply to recovering a damaged journal receiver that was attached to a local journal.
Do the following:
1. Type WRKJRN.
2. On the prompt display, type the name of the journal that is associated with the damaged journal receiver. You are shown the Work with Journals display.
3. Select option 7 (Recover damaged journal receivers).
Type of object - Journaled file Advice - for a journaled file that is damaged, do the following:
1. Find your most recent saved copy of the file.
2. Delete the file.
3. Load the save media and restore the file. Type:
RSTOBJ OBJ(object-name) OBJTYPE(*FILE) SAVLIB(library-name) DEV(media-device-name)
4. Restore any journal receivers that are needed to recover the file, if they are not already on the system.
5. Use the APYJRNCHG command to apply journaled changes.
Do the following for a journaled file that could not be synchronized:
1. Restore the file from your most recent saved copy.
2. Apply journaled changes to bring the file up to date.
Note: You may need to perform this procedure for all the files if there are other files related to the file that is not synchronized. Otherwise, the files may not be synchronized with each other.
Type of object - All others Advice - use the following procedure to recover most damaged objects on the system.
1. Find your most recent saved copy of the damaged object.
Note: If the damaged object is in the QSYS library, you may need to restore the operating system. Contact software support for assistance.
2. Delete the object.
3. Load the save media and restore the object. Type:
RSTOBJ OBJ(object-name) OBJTYPE(object-type) SAVLIB(library-name) DEV(media-device-name)
9. Watch for additional indications that objects have been damaged. Some indications are:
You cannot start the system because auxiliary storage is full.
The system has ended abnormally several times since the last time you ran the Reclaim Storage(RCLSTG) procedure.
You see objects on the Work with Objects by Owner display that have no library associated with them.
The system status display shows an unexpectedly high percentage of auxiliary storage that is used.
You cannot access the data in a database file because a member is damaged. Message CPF8113 indicates this.
You cannot access objects because a damaged authorization list or authority holder secures them.
If you see these indications on your system, run the RCLSTG procedure.
If you see these indications after a disk unit was replaced and the data was restored from a partial pump, you should recover the entire ASP that contained the failed disk unit.
Code: CPF3113 - Member damaged
CPF3175 - File is not synchronized CPF3176 - Data space is partially damaged CPF3171 - Journal is damaged
Managing Group profiles
Profile parameters on the user profile setup. The Group Profile is the user's primary group that their work will be associated with.
The Supplemental Group Profile lets you also associate the user with up to 15 additional groups other than the primary group.
2. Once the user's profile is set up this way, you no longer have to manage their individual user profile for granting security permission to use resources on your system. All you need to do then is manage the group profile setup. If you have 100 users on your system, but they can be broken down into five work groups,then all you need to worry about are the five group profiles. As you can see, this will greatly simplify the work needed for security administration.
3. To implement group profiles, you should first design your groups. You should take into account the type of work performed and the software applications that will be used by users in each group. Remember that you can also use Supplemental Group Profiles if there are gray areas where this will help you subdivide application controls.
4. Supplemental Group Profiles can also be used for those users, such a supervisors, who need access to multiple group resources on your system.
Note: You cannot implement Supplemental Group Profiles without first assigning a primary Group Profile to a user.
5. Once you have your groups designed, then go ahead and create a user profile for each group. Since these profiles will not actually be logging on, you can set the profiles up with the password set to the special value of *NONE. This way, users cannot sign on using the group profile itself.
I recommend that you create new profiles for groups and not use any existing groups, especially the IBM supplied Qxxxx profiles.With these Group Profiles created, you can now work on assigning your existing users to their respective groups. This is done from the WRKUSRPRF command or you can perform the updated individually using the CHGUSRPRF command and setting the GRPPRF parameter for the primary group and the SUPGRPPRF parameter for any supplemental groups that you want to use. Last, but definitely not least, you will have to update your object security to reference the new group profiles rather than individual profiles. When this is all setup, the only complication will be properly grouping new users as they are added to your system.
6. The setup can be complex, but the rewards in reduced security
Monday, January 18, 2010
All Interview questions AS400
What are the six levels of entries in logical file?
(i) File level entries (optional): File level entries give the system information of the entire file. You can specify whether the key is same as physical file.
(ii) Record format level entries: Record format level entries give the system information about specific record format in the file. for examples ,for a logical file when a record format is described we can specify the physical file it is based on.
(iii) JOIN Level entries: Join level entries give the system information about PF used in a JOIN LOGICAL FILE. (It is not applicable to NON JOIN LOGICAL FILES).
(iv) Field level entries (optional): The field level entries give the system information about individual fields in the record format.
(v) Key field level entries: The key field level entries give the system information about the key fields of a file. The field names used as key fields are specified.
(vi) Select / Omit level entries: These entire give the system information about which records are to be returned to the program when processing the file. These specifications apply to logical file only.
Explain JDUPSEQ and JDFTVAL.
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])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.
JDFTVAL:
When this file-level keyword is used the system provides default values for all for fields when a join to a secondary file does not produce any records.
If this keyword is not specified a record in the primary file for which there is
no corresponding record in the secondary file is skipped.
Explain normalization?It is the process of segregating and decomposing information held within a system into logically grouped, related. Uniquely identifiable entities.
What are various steps accessing data area in CL?
The first create a general data area use the command (CRTDTAARA)
To retrieve values from data area use (RTVDTAARA)
To change this value, use (CHGDTAARA)
To display the current value, use (DSPDTAARA)
To delete a data area use (DLTDTAARA)
Mandatory keywords for subfile
SFL
SFLCTL
SFLSIZ
SFLPAG
SFLDSP
What is a Module?
A module is a non-executable program and it contains one or more procedures. If you have modules without procedure then it means that it is having only one default procedure and in case we can use CALLB. We are creating a RPGLE module by CRTRPGMOD and a CL module by CRTCLMOD commands.
How to the create module?
A module is created as a separate object type (*MODULE). Using the CRTRPGMOD command creates an RPGLE module. A module object cannot be run directly. You must use the CRTPGM command to bind module object into a program object. First option 15 or CRTRPGMOD command to create a module. The CRTPGM command is used to cerate a program from one or more module.
Explain procedure used in RPGLE?
A procedure is a non-executable program. If a module is having more than one procedure then we can give explicitly the procedure name to be called in case of CALLP.
v Defining the prototype:
Prototype will specify the following things
ü Parameter type
ü Sequence of the parameter
ü Return variable and its type
ü It tells the name of the procedure and also the type of the call.
It will avoid all the run time problems like parameter mismatch by specifying the prototype.
v Prototype interface
It is like *entry parameter where we will specify the parameters that are received in this program.
v Import and export
If you want to specify the procedures to be the external programs then we can specify EXPORT in your procedure.
v Global and local variables
If you declare a variable in main procedure then it will be accessible in all sub procedure and this is global declaration and if you specify the declaration in the sub procedures then it will not be accessed in other procedures or in the main procedure.
v Return
If we specify return in the sub procedure then it means that we are returning something to the calling program. We can return a maximum of only one variable to the calling program.
v Recursion
A procedure calling to it self is known as recursion.
v Pass by value/pass by reference
In case of pass by reference we are passing the address of the parameters and not the actual value and so the changes in the called procedure will affect the value in the calling program. In OPM program we are using only call by reference and in RPGLE we have the option to pass the parameter by giving the keyword VALUE.
v CALLP/Expression
We can call the procedure by using CALLP command if it is not having any return type and by an expression if it returns any value.
How you can import and export a data type between 2 programs?
If you are using an export statement when declaring a variable then the data type can be imported in any modules that is bind either by value or by reference. So in this case we can pass values in between modules instead of using PLIST and *ENTRY.
What is the difference in between CALL, CALLB and CALLP?
CALL is a dynamic call where the control will be transferred when the program is executed. (Control will be transfer the another program (run time) so it is dynamic call).
Where as CALLB and CALLP are static calls. A module is a non-executable program and it contains one or more procedures. If you have modules without procedure then it means that it is having only one default procedure and in case we can use CALLB.
A module is having more than one procedure then we can give explicitly the procedure name to be called in case of CALLP out of these three CALLP is the most efficient one. (Using the CALLB, CALLP a program or module is bind in the program so it is static.)
How to create a service program and what are the steps involved in this?
The service program means most commonly used modules are grouped (binding) together to form it is called service program.
A service program is not bound to its caller until activation time
While creating service program we can create a binder program where we can refer the modules (or) procedures (or) even data types to be used by the program. Which is using service program.
Advantages of service programs
They do not take up auxiliary storage space. There is only one copy for all users.
There is only a single copy of the read-only code in main storage for all users in this service programs is the same as a program that you call dynamically.
Each user of the service program has an independent work area.
You can pass parameters to a service programs by using the traditional parameter list (or) by importing and exporting variables.
Service programs can be maintained independently of the programs that use the functions. In most cases, changing a service programs does not cause a program using the function to be changed or re-created.
Disadvantages of service programs
Service programs are less desirable for a function you may or may not need. The reason is that it is slower to call a main program that refer to a service program
What is an activation group?
Activation group is the boundary set for similar programs. Activation group is also a storage space in memory.
CLP has a OVRDBF command and calls a RPGLE program
RPGLE program performs a read operation and the pointer is now in the second program and now call the program 3
RPGLE program that also do a read operation which will read the second record
Since the pointer is in the second position and then return to 2nd program in the above situation when the control transfer from 3rd record since the 2 rd record is already read in program 3. But we need to need the 2nd record according to the logic but this is not possible in any OPM programs. But in RPGLE there is a solution for this problem by giving a common activation group for 1st and 2nd program and have a separate activation group for the 3rd program while creating the program itself and this will avoid all the problem we faced before.
In some situation we want to share between 2 program then we can give the activation group in *job level in which the changes in one program will be affected in another program.
Types of activation group levels:
*New: In this case every time you call the program an new activation group will be created which this case will not be used mostly.
*caller: If we don’t know the type of the program that is calling then we can specify *caller where the activation group will be the same of the program that is calling.
Named activation group: We can give our own named for different activation group.
What are the statements that are affected by activation group?
ü OVRDBF
ü OPNDBF
ü OPNQRYF
ü STRCMTCTL
ü DLTOVR
All Interview questions AS400
How many ways you can copy records?
CPYF
CRTDUPOBJ
In CL which command is equivalent to EXFMT?
SNDRCVF
What is the difference between MOVE and EVAL?
Using MOVE we can move values from variable of one Data type to another. In case of EVAL both the variable types should be of same type.MOVE just moves value from one variable to another. But EVAL first initializes the variable and then it moves the values.
By what all ways we can insert values in a file?
CPYF
STRDFU
In STRSQL by using INSERT statement
By what all ways we can view records in a file?
STRDFU
RUNQRY command
DSPPFM
DSPF
In STRSQL by using SELECT statement
What is the use of DSPPGMREF?
The Display Program References (DSPPGMREF) command provides a list of the system objects referred to by the specified programs.
Usage of *INZSR and *PSSR.
It is first executable routine in a RPG Pgm. Essentially all variables & Data structures, Array definitions get initialized in this routine.
PSSR is the default Exception/Error handler for RPG Programs. We
can also define our own *PSSR routines in the PGM.
How many Types of jobs there are present on as/400.
5 jobs-
Prestart
Interactive
Batch
Auto start
Communication
How many user classes are there ?
There are five user classes
*SECOFR *SECADM
*PGMR *SYSOPR
*USER
Type of Sub file & define each one of them.
3 types of subfiles are there.
In Brief:
Single-Page Subfile
- Large set of data
- Highly random selection
- Forward and backward roll
- Programmer provides roll logic
Multi-Page Subfile, Single-Page Load
- Random access to large file
- Forward roll from selected point
- System-provided roll logic
Multi-Page Subfile, Multi-Page Load
- Maximum rolling through small file
- Complete system-provided roll logic
- Performance drag at program initialization
How to create user define command?
By using the CRTCMD command process the command definition statements to create the command definition object. The CRTCMD command may be run interactively or in a batch job.
Steps for creating CRTCMD commands
1.Enter the command definition statements into the source file
Command type CMD
VRAMANA/CLP
CMD1
*************** Beginning of data ****************************
0001.00 CMD
****************** End of data *******************************
2. Enter source program in any language
VRAMANA/CLP
DLIB
TYPE :CLP
*************** Beginning of data ******************************
0001.00 PGM
0002.00 DSPLIBL
0003.00 ENDPGM ****************** End of data *********************************
DUMP
Dump is a opcode in RPG which is used to force to produce a dump if any error occurs. It is used in program status data structure or file information data structure and it is used for a user to see if any error occurs in the system. We have to specify debug(*yes) in h-spec to make a dump.
How to convert a field from Uppercase to lowercase?
(Ans)
By using XLATE command we can convert a field from upper to loew case or vice versa.
FDSPF001 CF E WORKSTN
Dlower S 26A inz('abcdefghijklmnopqrstuvwxyz')
Dupper1 S 26A inz('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
C *in03 doweq *off
C exfmt casecon
C 03 leave
C if *in09=*on
C upper1:lower XLATE lowcase upper
C endif
C enddo
C seton lr
Here lowcase and upper are the two fields in the screen and the user is entering characters in lowcase in upper case and convert that to upper case and move it to field upper when user press f9 key.
HDEBUG(*YES)
dpssr sds
DSTATUS *STATUS
DROUTINE *ROUTINE
DPARMS *PARMS
dRES S 2S 0
C Z-ADD 1 NUM1 2 0
C Z-ADD 0 NUM2 2 0
C EVAL RES=NUM1/NUM2
C 'NOTCOM' DSPLY
C A TAG
C 'COMING' DSPLY
C SETON LR
C *PSSR BEGSR
C STATUS DSPLY
C ROUTINE DSPLY
C PARMS DSPLY
C DUMP
C GOTO A
C ENDSR
In the above example divide by zero exception is caused and the control will be transferred to *pssr routine where it is making the dump and move the control to tag a. This program also illustrate the usage of parms status, routine keywords in program status data structures
How to copy a file from as/400 system to a local pc.
Do the following to copy
ftp as/400 machine ip address
In wipro case ftp 10.200.9.80
It will ask for user name and password. Enter your as/400 user id and password. It will then say the user has logged in successfully.
If you want to copy a rpgle program called load2 residing in shyamrlib library and source physical file name is shyamrile then we have to change the current library into shyamrlib .Just type cd shyamrlib and it will change the library. And then get shyamrile.load2 will copy the file into c:\ in local pc. If you want to copy from a PC to as/400 library then do the following
To do: Copy from c:\shyam\load2 to shyamrile\load2 in shyamrlib
Steps:
cd shyamrlib
put c:\shyam\load2 shyamrile.load2
will copy the file in shyam in c directory into shyamrile in shyamrlib.
How will your read a 100th record in a group of records in a file?
Declare the file without K in record address type in file definition.
z-add the position you want to retrieve. Suppose you want to retrieve 125th records
then z-add 125 to rrn
Do chain based on rrn.
fworkfile1 if e disk
c z-add 2174 rrn1 4 0
c rrn1 chain workfile1 40
c seton lr
Here we are reading the 2174th record.
Is it possible to send arrays,data structures as a parameter to another program?
Yes it is possible and we have to call in the same way a parameter is passed in the program.
Ex:
darr1 s 2p 0 dim(10)
darr2 s 2p 0 INZ(1)
c callB 'ARR2PGM'
C PARM ARR1
C 1 DO 10
C ARR1(ARR2) DSPLY
C ADD 1 ARR2
C ENDDO
c SETON LR
called program
DARR1 S 2P 0 DIM(10)
DI S 2P 0 INZ(1)
C *ENTRY PLIST
C PARM ARR1
C 1 DO 10
C EVAL ARR1(I)=I
C ADD 1 I
C ENDDO
C SETON LR
Here the array is passed as a parameter and the values after callb is 1 to 10
What is program entry procedure (PEP) and User entry procedure (UEP)
If we are binding many modules together to form a program then we have to specify which module has to take control first when it has been called and that module is called as PEP for that program.
User entry procedure is the first statement that takes the control when a program has been called. For example in C programs main( ) will be executed first when it has been called and like wise in RPG the statement coded in C spec will take the control first.
Discuss about option keyword in detail
options(*varsize) : It is similar to declaring the variable as varchar instead of char. So if we declare a variable with size 100 and if you initialize with shyam then it will allocate only 5 spaces.
Options(*nopass): This means that this parameter can be passed or even omitted
Options(*omit): We can give both *nopass and *omit for a single variable.
Options(*string): If we are passing string to the called program and if it is expecting the pointer then in such case we can give this option.
Explain the usage of the terms GROUP BY, HAVING, ORDER BY.
A. GROUP BY - the column function will calculate its result based on the individual groups created by GROUP BY specification creating one result for each group. HAVING - is used to specify the conditions each row of each returned group must satisfy.
ORDER BY - used to sort the output of a query using the column names or position of column in the list of columns named in the select expression.
What is a CURSOR and how is it operated for read, update, delete?
A. A cursor is a named control structure used to make a selected set of rows available to a program one row at a time for read or update.
DECLARE CURSOR, OPEN CURSOR, FETCH CURSOR, CLOSE CURSOR
are used to operate the cursor. The results table will be created during the execution of theOPEN CURSOR statement. The values are fetched from the table row into the host variables and the cursor position remains on the row until the next FETCH or CURSOR CLOSE statement. During this time ,the cursor position could be used to update or delete this row from the table using the WHERE CURRENT OF clause.
All Interview questions AS400
What are the different ways to input data into a data area ?
CHGDTAARA (using CL)
Using OUT opcode in RPG
How do you retrieve data from data area ?
Using RTVDTAARA command in CL
Using IN opcode in RPG.
What are the valid user defined data area types ?CHAR, NUMARIC and LOGICAL.
What are the valid data types for a data queue ?
Char, Numeric, and Logical.
What are the types of object authorities ? *USE, *CHANGE, *ALL, *EXCLUDE, *AUTL, *OBJEXIST, *OBJMGT, *OBJOPR, *ADD, *DLT, *READ, *UPD.
Explain CASxx, and CABxx statements ?
CASxx operation allows you to conditionally select a subroutine for processing. The condition is based on the relationship between factor 1 and factor 2 as specified by xx.If the relationship is true the subroutine specified in the result field is processed.
CABxx operation compares factor 1 with factor 2 , if the condition specified by xx is true, the program branches to the TAG operation associates with the label specified in the result field.
How do you combine two record formats in RLU ?
Using CLC.
How do you split record formats in RLU ?
Using CLR.
What is the use of SDA ?
Screen Design Aid is used to create display files interactively.
How do you define overlapping fields in SDA ?
They can be defined through condition indicators.
Mention different ways of specifying user help.
Through SDA and Panel Group.
To which member type does help text for panel belong ?
PNLGRP
Can Printer files be externally described or program described ?
Yes.
What are the valid file operation codes for a PRINTER file ?
WRITE, OPEN, CLOSE, FEDO.
If you use INDARA keyword for a program-described PRINTER file, what will be the result ?
You will get run-time error.
What is PRTCTL, and where will you define it ?The PRTCTL (Printer Control) option allows you to change control information and to access the current line value within program for a program-described PRINTER file.PRTCTL option will be specified on a F specifications continuation line for the PRINTER file.
What is the function of RLU ?
To design & prototype a report.
What are the three types of keywords associated with printer file ?
File level, Record level & Field level.
What are the three line types in RLU ?
Report line, Filler line & Sample line.
Which option number is used to invoke RLU ?
Option 19.
What are the different commands used in RLU ?
DR - Define Record, CLC - Change Line for Continuation, CLR - Change Line for Record, SD - Create Sample Data, VF - View Fields, NP - New Page, DC - Define Constants, DF - Define Fields, CF - Centre Fields & SP - Space Fields evenly.
What is the command used to invoke RLU ?
STRRLU.
What are different record spacing keywords in RLU ?
SKIPA, SKIPB, SPACEA & SPACEB.
Sunday, January 17, 2010
All Interview questions AS400
16 How can you search an entire source file for a particular field name? In wrkmbrpdm screen enter option=25, then shift + F1. Enter the test that you want to search. Results will be shown. If the search string needs to be searched in particular source hit F16. FNDSTRPDM.
How can you find the differences between two versions of the source for the same program? one can use CMPPFM command or option 54.
What is a hidden field as it relates to a sub file? Hidden field is just like any other field in subfile. Only difference you will not be able to specifiy position location for the field. That is why it is called hidden field.
How do you display a sub file that has no records in the sub file? Use SFLINZ keyword. Before doing the EXFMT to control record set on the SFLINZ controlling indicator.
How to monitor error messages in RPG?
Method 1: To moniter Error in RPG make use of MONITIOR ..... ON-ERROR ENDMON u can place a subroutine , procedure etc under this to handle the error for the following
Method 2: Use E Extender
Method3: Use of *pssr
What is the RPG cycle?It is RPG400 Logic means it is a compiler logic through which system reads the primary file starting from begining to end of file. No File operations like read/chain can be used.System has the control of the program.
Use of SFLRCDNBR? This keyword allows us to specify what page we have to display when the program issues the write or EXFMT screen. For example subfile size is 35 & subfile page is 10 and at anypont we have to dispaly 33th record directly. For it we have to add one line in display file. A var-name size dec.position use Function A var 4 0 H SFLRCDNBR
Use of *MAP and *DROP? When we copy data from FILE A to FILE B and if FILE A has 20 fields and FILE B has 30 fields (say there are 10 fields which is not common among both the files). Using *MAP and *DROP option we can copy the data from FILE A to FILE B.All the fields would be mapped between both the files and the unmatched fields would be dropped.
why we use option(*nodebugio)in H- Spec? *NODEBUGIO is used to avoids debugging I/O operation while using STRDBG command to debug the program. When *NODEBUGIO is not used, and if a file level opcode is being debugged, the control would move to the F-Spec and it will keep executing the steps until the file operation gets completed and then the control would move to next step. When *NODEBUGIO is used, and the above mentioned detail is ignored. The file level opcode would get executed at a single point execution and the program would move to next step.
what is the procedure of debugging the service program?service program will always be binded and it can't be called directly.Now, to create a wrapper:create one RPG Program in which service progrem is binded Now, to debug, Strdbg SRVPGM(ABC) add break point now call the Wrapper program. ------or ----------------------- Strdbg Wrapper program name than F14 to work with module list and add your service program(*SRVPGM) and add the break. Call wrapper.
You have a *USE authority on a Library and *All authority on a file in that Library.Can you change the data in that file? Yes we can change data on file.
HOw to Debug a job that has *MSGW status? dspjoblog dspjob ,check, if there has any lock waiting statue. strsrvjob and debug.
Use of MDT? If you perform read on the subfile, the internal indicator MDT (modified data tag) is automatically set off by the system. If you again perform read on the same records, records won't be read. Because internal indicator MDT would be off. Hence you should be explicitly set on the MDT by SFLNXTCHG keyword.
Can we have a Physical file without any member ? Yes we can have a PF without a member. while comiling the file we can give member option - None . which will not create a member. But in order to store data and access it member is required.
What is the name of default out queue when user logs inn to syatem with valid profile?default out queue name is same as userid and located in QGPL lib. by using WRKUSRPRF command you can checked it.
How to find d key field of a pf that doesn’t have source physical file? DSPFD FILE(FILE1) TYPE(*ACCPTH)
steps for debugging two rpg programs? (PGMA>>>Calling>>PGMB)both are rpg pgms. Compile PGMA with source type(*SRCDBG) and PGMB with (*Source) 1)STRDBG PGMA 2)In debuging view press F14 and selct option 1 ,specify pgm name ,library. 3)press enter ,select module source from list,add break point in PGMB 4) Press F14, add brk point sin PGMA. 5) Call PGMA It will start the debugging for 2 pgms
How to set on/off a group of indicators in a single statement?C MOVE '00000' *IN(21).
Can an indexed file be accessed in arrival sequence in RPG? By not specifying K in Record Address type.
When will DUMP & DEBUG be ignored? When you specify DEBUG (*NO) on H specification.
How can i keyed a flat file in RPGLE
FMASTER IF F 96 96 DISK A F KRECNO RRN
Should we /copy or /Include our copybooks? There's no difference between /COPY or /INCLUDE. The whole Idea is that you can not use nested /COPY directive in SQLRPGLE programs. That's you define a copybook which again defines some copybook. In that case you may get the following errors • The SQL preprocessor does not allow nested /COPY commands.
Is it necessary to preserve a copybook after we have compiled the main source file successfully? No, As soon as you compile the main source file, the copybook is no longer required. In fact you may delete the copybook.
Can we create copybook objects? Can we compile a copybook? Compiling a copybook is not the purpose of a copybook. Copybooks are just common portions of scripts in separate member. They are not meant to be compiled.
Reading Flat file?
FFlatfile IF A E Disk ** Rename the record format name
F Rename(Flatfile: FLATFILE01)
D W@FlatFile DS DFirstName 1 10
DLastName 11 20
DSex 21 26
DAge 27 28
0 ** IFLATFILE01 ** Associate the database field with data structure.
I FLATFILE W@FlatFile ** Everything set now. Use the flat flat as a physical file with four ** columns namely FirstName, LastName, Sex and Age! ** Read data from this flat file as you would do with any other PF.
C Read FLATFILE01
C DoW Not %EoF(FLATFILE)
C FirstName Dsply
C LastName Dsply
C Sex Dsply
C Age Dsply
C Read FLATFILE01
C EndDo
Write to the flat file using RPG IV.
FFlatfile IF A E Disk ** Rename the record format name
F Rename(Flatfile: FLATFILE01)
D @FirstName S 10
D @LastName S 10
D @Sex S 6
D @Age S 2 0
D W@FlatFile DS Inz
DFirstName 1 10
DLastName 11 20
DSex 21 26
DAge 27 28
0 ** IFLATFILE01 ** Associate the database field with data structure.
I FLATFILE W@FlatFile ** Everything set now. Use the flat flat as a physical file with four ** columns namely FirstName, LastName, Sex and Age! ** Write data to this flat file as you would do with any other PF.
C *Entry PList
C Parm @FirstName
C Parm @LastName
C Parm @Sex
C Parm @Age ** Populate file fields
C Eval FirstName = @FirstName
C Eval LastName = @LastName
C Eval Sex = @Sex
C Eval Age = @Age ** Write to the flat file
C Write FLATFILE01
C Eval *InLr = *On
C Return
How can we make use of SETLL operation in CL? OVRDBF FILE(File name) TOFILE(new file name) MBR(*first) POSITION(*RRN 55) 55 = record number OR OVRDBF FILE(File name) TOFILE(new file name) MBR(*first) POSITION(*KEY 1 RCD1 SYAM) 1 = no of key field RCD1= Record format name
Changing spool name or userdata?
Ovrprtf spoolname userdata
Runqry……
Dltovr spool
For printig text from Cl ?
CRTMSGF MSGF(QTEMP/MYMSGF)
ADDMSGD MSGID(A123456) MSGF(QTEMP/MYMSGF) MSG(TEST)
DSPMSGD MSGF(QTEMP/MYMSGF) DETAIL(*BASIC) OUTPUT(*PRINT)
How to know the number of records in a pf through clp program? runqry with output form as *SUMMARY parameter
What is the purpose of level checking? To ensure that the version of a file used by a program has not changed since the program was compiled
What is the difference between CA and CF command keys? CA means that screen validity checking is bypassed and no screen .data is passed to the program. CF means that screen validity Is it necessary to give PGM in CL program?No,It is only required if Parameters are to pass in the program.
Friday, January 15, 2010
All Interview questions AS400
1) How user profile is created?
Ans: CRTUSRPRF
2) How will you limit user profile ASP or storage capacity?
Ans: In user profile there is parameter MAXSTG which is used to allocate the user the maximum size. The default value is *NOMAX.
3) How will you limit a user profile?
Ans: In user profile there is parameter LMTCPB which is set to *YES, this will limit the user to command line.
4) How will you grant authorities or revoke authorities to a user profile?
Ans: GRTOBJAUT.If the object is created as a private object or with the limited authority given to all users, the owner can grant more or less authority to specific users by specifically naming them and stating their authority in the Grant Object Authority (GRTOBJAUT) command. The owner also can withdraw specific authority from specific users, or from all users (publicly authorized and/or specifically authorized) by using the Revoke Object Authority (RVKOBJAUT) command or the Edit Object Authority (EDTOBJAUT) command.
5) How will you restrict a single user from submitting his or her job to a particular subsystem?
Ans: ADDWSE, The workstation name or the workstation type should be specified in the subsystem description on the iSeries server. Use the Display Subsystem Description (DSPSBSD) command to see the workstation entries defined to the subsystem.
6) How many types of profile is their in iSeries and what are the authorities lying with them by default? What is the importance of those authorities?
Ans: *USER
At QSECURITY level 10 or 20, the user has *ALLOBJ and *SAVSYS authority.
At QSECURITY level 30 or above, the user has no special authorities.
*SECOFR
At all levels of security, the security officer is granted the following special authorities:
· *ALLOBJ
· *SAVSYS
· *JOBCTL
· *SERVICE
· *SPLCTL
· *SECADM
· *AUDIT
· *IOSYSCFG
*SECADM
At QSECURITY level 10 or 20, the security administrator has *ALLOBJ, *SAVSYS, *SECADM, and *JOBCTL special authorities.
At QSECURITY level 30 or above, the user has *SECADM special authority.
*PGMR
At QSECURITY level 10 or 20, the programmer has *ALLOBJ, *SAVSYS, and *JOBCTL special authorities.
At QSECURITY level 30 or above, the user has no special authorities.
*SYSOPR
At QSECURITY level 10 or 20, the system operator has *ALLOBJ, *SAVSYS, and *JOBCTL special authorities.
At QSECURITY level 30 or above, the user has *SAVSYS and *JOBCTL special authorities.
7) What is job queue? What is the command to create it?
Ans: CRTJOBQ.the jobs which has to be executed first it gets into jobque and then based on the priority it is executed in subsystem.
8) How many job queues can a subsystem have?
Ans: maximum of 9999 jobques can be attached to a subsystem.
The subsystem first selects jobs from the job queue with the lowest sequence number. When all jobs on that queue have been processed or the number of jobs specified on the Maximum active jobs (MAXACT) parameter has been reached, the subsystem processes jobs on the queue with the next higher sequence number. This sequence continues until all job queue entries have been processed, or until the subsystem has reached its limit for overall maximum jobs. In some cases, the sequence is interrupted and the subsystem processes a job queue with a lower sequence number. This occurs for this subsystem when one of the following conditions occurs:
A held job or job queue is released.
A job is placed on or transferred to a job queue.
A new job queue is allocated.
A job ends.
10
A sequence number of 10 is assigned to this job queue.
1-9999
Specify the sequence number assigned to this job queue. The sequence number must be unique in the subsystem description.
9) What is subsystem? How it is created?
Ans: subsystem provides resources for the jobs to process.
Note: IBM supplied SBSD are in libraries QSYS and QGPL,it is recommended not to change these.
We can creat SBS in two ways one is by copying the existing SBSD and change it or we can creat an entirely new description.
To copy an existing subsystem description:
1. On a command line, type CRTDUPOBJ, to create a duplicate object of an existing subsystem description.
2. Change the sign-on display file and the system part of the library list for the secondary language.
To create an entirely new subsystem description:
1. Create a subsystem description (CRTSBSD). Specify a sign-on file from the national language version library and specify the national language version library (QSYSnnnn) as the system-library list entry.
2. Create a job description (CRTJOBD).
3. Add work entries to the subsystem description.
a. ADDWSE (Add work station entry)
b. ADDJOBQE (Add job queue entry)
c. ADDCMNE (Add communications entry)
d. ADDAJE (Add autostart job entry)
e. ADDPJE (Add prestart job entry)
4. Create a class (CRTCLS).
5. Add routing entries to the subsystem description (ADDRTGE).
11) What is job description? How it is created?
Ans: The job description can be used as the source for some of the job properties that tell the system how to run a job. The properties tell the system when to start the job, where to get the job from, and how the job will run. Job descriptions are used by autostart, batch, interactive, and prestart job types. You can use the same job description for multiple jobs.
12) What is routing entry? What is the command to create it?
Ans: To reach remote networks, at least one routing entry is required. If no routing entries are manually added, your server cannot reach systems that are not on the same network to which the server is attached. You must also add routing entries to allow TCP/IP clients that are attempting to reach your server from a remote network to function correctly.
13) How will you find out the status of a particular user job?
Ans: wrkjob (jobname)
14) How will you submit or schedule a job?
Ans: SBMJOB is the command to submit a job
15) How many types of jobs are their?
Ans: Batch,Interactive
16) How will you work with a particular type of subsystem job?
Ans: WRKACTJOB SBS(Subsystemname)
17) What is spool file?
19) How will you find out which job is taking much CPU and ASP%?
Ans: wrkactjob and place the cursor on the column CPU and press F16 and F18, this will arrange the job using more CPU.
All Interview questions AS400
DW@Count S 2P 0 Inz(2)
**
C For W@Count = 1 to 6 by 2
C W@Count Dsply
C EndFor
C Return
2.Use of TFRCTL
To transfer control completely to the called program and force the OS not to log specific program call, Use the TRFCTL (Transfer control).
3.Compile Time array
• DW@RTime S 5P 0 Dim(4) CTDATA PerRcd(2)
• D @Indx S 1P 0 Inz
• C Do 4 @Indx
• C W@RTime(@Indx)Dsply
• C EndDo
• **
• C Return
• **CTDATA W@RTime
• 0010100102
• 0010300104
4.How to comment CTDATA
There is no way od commenting the data for compiling time array.You only have to delete it.
5.Use of Read(E) File1
traps any error occurred while reading the File1 using the extender 'E'. Whether error occured or not during the read operation, can be verified by the %Error built in function. In case of error this return *On or '1'.
6.use of Read(N) File2
• The Read(N) opcode uses the extender N to 'read without lock'. When a file has been declared in update mode, the read operation results in a lock on File2. It means the record will not be available for any other program for updation unless you unlock it. If you are not doing this read for any updation, it is advised to use the 'N' extender to read without lock. This extender can be used with all other read operation like CHAIN(N), READE(N), READPE(N), READP(E) etc.
7.Update(E) RCD001
The Update(E) traps error occurred during updation.
8.C *ISO Test(DE) W@ABC
The Test(DE) tests whether w@ABC contains a valid *ISO date or not. In case of error the %Error function return *On or '1'.
9.difference between %scan & %check%scan-The result field contains the numeric value of the leftmost position of the compare string in the base string, if found.
XYZ SCAN ABCXYZ RESULT? = 4
(Factor 1 String is found starting at position 4 of Factor 2 String)
XYZ CHECK ABCXYZ RESLT1? = 1
(First position of Factor 2 String is not found in Factor 1 String)
10.Difference between DSPATR(PC) and CSRLOC
DSPATR(PC)
Positions the cursor on the first character of the field.
CSRLOC
Specifies the cursor location used when the record is displayed.
11.to see the userids of the users from RPG program?
Use the Program Data Structure (SDS) in D-Spec.Positions 254 to 263 gives you the user running th program
12.To see the userids from CL program?
RTVUSRPRF
13.How we will read call stackfor a job?
wrkjob+option 11
14.How can we find out whether the job is interactive or Batch through RPG program?
QUSRJOBI API can be used to find out whether the job is interactive or batch from RPG program Field QUSJT04 will contain B for batch or I for interactive
15.How can we find out whether the job is interactive or Batch through CL program?
RTVJOBA