AS400 interview questions and answers-Part 7


1. What is data structure in AS400? What is the use of data structure?

 Ans:

 DATA STRUCTURE 

 

§   Data structure in general means a structure of different data type.

§   Data structure is specified in the Input Specification of an RPG 3 Program whereas in RPG 1V we specify it in 'D' specification.

§   Data Structure is used-

1. To break fields into subfields

2. To Group fields

3. To change the format of the field

4. To Group non-contiguous data into contiguous format

5.To convert data.

   *** For more information please refer: Click here...

 

 

2. What are the types of data structure in AS400? Give example of data structure?

Ans:

 

Below are the types of data structures in as/400:

 

        I.            PROGRAM DESCRIBED DATA STRUCTURE

      II.            EXTERNALLY DESCRIBED DATASTRUCTURE

   III.            MULTIPLE OCCURENCE DATASTRUCTURE

    IV.            INDICATOR DATA STRUCTURE

       V.            DATA AREA DATA STRUCTURE (SPECIFIED IN 'U')

    VI.            PROGRAMME STATUS DATASTRUCTURE (SPECIFIED IN 'S')

  VII.            FILE INFORMATION DATASTRUCTURE

 

  *** For more information please refer: Click here...

 

 

3. What is program status data structure(PSDS) in AS400? Give example if PSDS.

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.

  *** For more information and example please refer: Click here...

 

 

4. What is file information data structure(INFDS) in AS400? Give example if INFDS.

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.

  *** For more information and example please refer: Click here...

 

 

5. What is indicator data structure in AS400? Give example indicator data structure.

The indicator data structure is used to rename the indicators used in our program with the name that is more meaningful and understanding.

If we want to use indicator data structure in our program then INDARA is a mandatory keyword in the display file used.

 


Columns . . . :    1  80                        Browse                    AMITCC/QRPGLESRC
SEU==>                                                                           RECDSPIND
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++
*************** Beginning of data ********************************************************
0001.00      A                                      INDARA          >>>> Mandatory keyword
0002.00      A                                      DSPSIZ(24 80 *DS3)
0003.00      A                                      CA03(03)
0004.00      A          R RECSFL                    SFL
0005.00      A            S_FLD01        5S 0B  7 20
0006.00      A          R RECCTL                    SFLCTL(RECSFL)
0007.00      A  42                                  SFLDSPCTL
0008.00      A  41                                  SFLDSP
0009.00      A  40                                  SFLCLR
0010.00      A  45                                  SFLEND(*MORE)
0011.00      A                                      SFLSIZ(9999)
0012.00      A                                      SFLPAG(0010)
0013.00      A            RCDNBR         4S 0H      SFLRCDNBR(CURSOR)
0014.00      A                                  1 25'TEST TO CHECK THE BUFFER'
0015.00      A                                  5 20'FLD01'
****************** End of data ***********************************************************



 

In the below program below is the alternate name that we have available for the indicators used in the program;

 

03 = KEY_EXIT

40 = SFL_CLEAR

41 = SFL_DSP

42 = SFL_DSPCTL

 

Hence, we can give any meaningful name to the indicators by using this data structure.

 

 


Columns . . . :    6  80                Browse                           AMITCC/QRPGLESRC
SEU==>                                                                         REC1100IND
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ******************************************************
0001.00 FRECDSPIND CF   E             WORKSTN SFILE(RECSFL:RRN)  INDDS(INDDS1)
0002.00 D P_INDDS1        s               *   inz(%addr(*in))
0003.00 D INDDS1          ds                  based(P_INDDS1)
0004.00 D  KEY_EXIT                      1N   overlay(INDDS1:03)
0005.00 D  SFL_CLEAR                     1N   overlay(INDDS1:40)
0006.00 D  SFL_DSP                       1N   overlay(INDDS1:41)
0007.00 D  SFL_DSPCTL                    1N   overlay(INDDS1:42)
0008.00 DI                S              5  0
0009.00 DRRN              S              5  0
0010.00 C                   EVAL      RCDNBR=9900
0011.00 C                   DOW       KEY_EXIT=*OFF
0012.00 C                   IF        KEY_EXIT=*ON
0013.00 C                   LEAVE
0014.00 C                   ENDIF
0015.00 C                   EXSR      CLRSFL
0016.00 C                   EXSR      FILSFL
0017.00 C                   EXSR      DSPSFL
0018.00 C                   ENDDO
0019.00 C                   SETON                                        LR
0020.00  *
0021.00 C     CLRSFL        BEGSR
0022.00 C                   EVAL      SFL_CLEAR=*ON
0023.00 C                   WRITE     RECCTL
0024.00 C                   EVAL      SFL_CLEAR=*OFF
0025.00 C                   ENDSR
0026.00  *
0027.00 C     FILSFL        BEGSR
0028.00 C                   FOR       I=0001 BY 1 TO 9900
0029.00 C                   EVAL      RRN=RRN+1
0030.00 C                   IF        RRN>9999
0031.00 C                   LEAVE
0032.00 C                   ENDIF
0033.00 C                   EVAL      S_FLD01=I
0034.00 C                   WRITE     RECSFL
0035.00 C                   ENDFOR
0036.00 C                   ENDSR
0037.00  *
0038.00 C     DSPSFL        BEGSR
0039.00 C                   EVAL      SFL_DSP=*ON
0040.00 C                   EVAL      SFL_DSPCTL=*ON
0041.00 C                   IF        RRN<=0
0042.00 C                   EVAL      SFL_DSP=*OFF
0043.00 C                   ENDIF
0044.00 C                   EXFMT     RECCTL
0045.00 C                   EVAL      SFL_DSP=*OFF
0046.00 C                   EVAL      SFL_DSPCTL=*OFF
0047.00 C                   ENDSR
****************** End of data *********************************************************



OUTPUT

 


                        TEST TO CHECK THE BUFFER                               
                                                                                
                                                                               
                                                                               
                   FLD01                                                        
                                                                               
                    9891                                                       
                    9892                                                        
                    9893                                                       
                    9894                                                       
                    9895                                                        
                    9896                                                       
                    9897                                                       
                    9898                                                        
                    9899                                                       
                    9900                                                       
                                                                        More...

 

 

6. How can we create subsystem in AS400?

Ans:

Steps of creating the subsystem

 

ü  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')

 

Here, the subsystem job will run in pool 2 and will use *BASE for main memory storage. There can maximum of 2 jobs inside the subsystem at a time.

 

ü  Create Job queue (CRTJOBQ)

Then we create a job queue as below:

CRTJOBQ   JOBQ (AMINEM/MYJOBQ) TEXT('My job queue')

 

ü  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.

 

ü  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)

 

ü  Add Routing Entry (ADDRTGE)

ADDRTGE SBSD(AMINEM/MYSBSD) SEQNBR(9999) CMPVAL(*ANY) PGM(SYS/QCMD) CLS(AMINEM/MYCLS)

 

ü  Start Subsystem (STRSBS)

STRSBS SBSD(AMINEM/MYSBSD)

Once the subsystem is started it can be used to submit the job.

 




 

 







User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy