Thursday, October 14, 2010

Customized TAB sequence in CA 2E(SYNON)

Introduction:

All Fusion 2E Screens are sets the default display sequence in all 2E screens. But we can also customize the TAB sequence based on our requirement, i.e., like from top to bottom or wherever user wants to move the cursor from one field to another. In some cases the TAB sequence will not work as developer mentioned the TAB sequence as expected. This will be a very interesting topic for any one to try out. The following scenario can be foreseen in any applications. The scenario is explained with a very clear example. The solution is also provided to overcome the problem.

Problem:

User wants to customize the TAB sequence for the fields in the below mentioned screen as from the fields (Top to bottom and Top to bottom) 1, 2, 3 etc as mentioned in the below EDTRCD screen Fig 1. The TAB sequence is given in the order as user wants but the cursor is not moved from field 1 to field 2 as expected. Instead TAB sequence is moved from right to left in the screen and continues the same in the entire screen.
In the screen (Fig 1), there are some constants are defined between the fields since these are all different headings they need. That will change the order of display sequence. For example let us consider a constant is added between the field 1 and field 2.The DSP Sequence for field is 1.00 and field 2 is 3.00.Here DSP sequence 2.00 will not be displayed since the added field is a constant.
TAB sequence will not work as we expect or as we have mentioned in the below case:
Let us consider the Display Sequence is given in ascending order for the screen fields and the next DSP sequence is missed(skipped) due to Constant fields ,Then other fields continues with increment with last Skipped DSP sequence number .And the TAB sequence is also in descending order for the skipped scenario fields mentioned in the Example 1 given below. In this case All Fusion 2E provides a facility to skip the DSP sequence and TAB sequence with descending order only 5 times .If exceeded by the 5 times, the TAB sequence won’t work as we expected/customized. Example 1: EDIT SCREEN FORMAT DETAILS: Field Func Typ Usg Ovr Display seq Tab seq
Column3 Row1 (21) DTA REF I I 14.00 15.00 Column1 Row2 (2) DTA REF I I 17.00 14.00
Column3 Row2 (23) DTA REF I I 18.00 16.00 Column1 Row3 (3) DTA REF I I 24.00 5.00
The fields in the below screen (Fig 1) are displayed based on the different conditions. For example if Header Type is ‘A’ then certain fields will display on the screen, if Type is ‘B’ some of the fields will display on the screen. If Type is ‘C’ some of other fields will display on the screen. Rests of other fields are hidden when those specific fields are getting displayed based on the Header Type condition. In this case the cursor should move correctly between the fields based on the developer designed the order. But it is not.
Fig1: EDTRCD screen:
  • PROGRAM *PGMMOD OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO DD/MM/YY
USER                TAB Sequence                        HH:MM:SS 
                             OOOOOOOOOOOOOOOOOOOO                              
Header OOOOOOOOOO Header Type O  HeadDescription                                 
Head Type Table number, press Enter. -     
                                         
                    Column1       column2         Column3       Column4     
Row1           1. -                          21. -                       
Row2     2. -                          23. -                        
     Head1 Head2      Head3  Head4
Row3    3. -          10.-            22. -          30.-            
     Head5 Head6      Head7  Head8 
Row4          4. -          11.-            24. -          31. -       
   
  Row5       5. -          12.-            25. -          32. -           
  Row6   6. -          13.-            26. -          33. -           
  Row7   7. -          14.-            27. -          34. -           
Row8                OOOOOOOOOOOOOOOOOOOOOOOOO                          
Constant Text 
Row10               OOOOOOOOOOOOOOOOOOOOOOOOO                             
Row11          OOOOOOOOOOOOOOOOOOOO    Value -----           
Date1 66/66/66    Date2 66/66/66    User OOOOOOOOOO           O 
F3=Exit   F12=Previous                                                         
                                                                               
Note: 1. Arrow mark shows how the TAB sequence needs to move as per the Requirement. 2. Highlighted Blue color fields are constants defined to display in different conditions. DSP Sequence and TAB sequence are given for the screen as below: EDIT SCREEN FORMAT DETAILS Field Func Typ Usg Ovr Display seq Tab seq
Column3 ROW1 (21)        DTA  REF  I   I       14.00      15.00
Column1 Row2 (2)    DTA  REF  I   I       17.00      14.00
Column3 Row2 (23)         DTA  REF  I   I       18.00      16.00
Column1 Row3  (3)    DTA  REF  I   I       24.00       5.00
Column4 Row3  (30)         DTA  REF  I   I       27.00      18.00   
Column1 Row4 (4)      DTA  REF  I   I       33.00       7.00   
Column4 Row4 (31)         DTA   REF  I   I      36.00      20.00
Column1 Row5  (5)      DTA   REF  I   I       40.00       9.00
Column4 Row5  (32)          DTA  REF  I   I       43.00      22.00 
Column1 Row6  (6)       DTA  REF  I   I       45.00      11.00
Column2 Row6  (13)         DTA  REF  I   I       46.00      23.00
Column3 Row6  (26)      DTA  REF  I   I       48.00      12.00
Column4 Row6  (33)         DTA  REF  I   I       49.00      24.00  
Column1 Row7   (7)       DTA  REF  I   I       51.00      13.00  

What will happen while compiling?

In this case in DDS source of this screen the FLDCSRPRG command won’t be written for any of the fields. Due to this reason the TAB sequence will not work as we given in the screen.

How the code will be in DDS?

Example for one field: In this case FLDCSRPRG is not written for the fields. The following code will be generated without FLDCSRPRG.
Sample Code keywords for a field:
DSPATR(MDT) CHECK(AB) OVRDTA DSPATR(PR) DSPATR(RI PC) DSPATR(ND) DSPATR(UL HI) COLOR(PNK) OVRATR
The FLDCSRPRG is not coded in DDS for this display file.

Reason:

The DSP sequence number is not continued in the order (i.e. some of the DSP sequence number is skipped and TAB sequence number is in descending order for these fields. And it occurs more than 5 times.)

Solution:

To solve this problem we need to define a dummy field between the skipped DSP sequence fields in the screen and give the Display Sequence as continuous from the previous filed DSP sequence number without skipping the DSP Sequence (i.e. the number is continuous and not missed out the next number) and give the TAB sequence for the added field is same as the previous one or add + 1 with the previous TAB sequence.
If the TAB sequence is not working in any of your screen do the following:
1. Identify the number of count is greater than 5 for the descending order TAB sequence with DSP sequence skipping the next field case.
2. Add the Dummy fields between the DSP sequence skipped fields. And set the attribute as Non display for the added dummy fields. Give the DSP sequence number as continuation from the previous one.
Example2 : The number of count is 7 in Fig 1 and allowed combination(Skipped DSP sequence number and descending order TAB sequence ) is 5 .The remaining combination is 2. Now we need to add two dummy fields between any of the two set of combinations.
Add two fields like TEXT1 between any of the above combination and TEXT 2 between another above combination mentioned as below Fig 2. TEXT1 & TEXT2 fields are should be input and give the field attribute is Non display for the added fields and Non Display to text of the field as mentioned in the Fig 3 ,so that the field will not be displayed in the screen.(Note: we should not give those fields are as Output or Hidden . If we do this it will not solve our purpose)
Find the sample screen while insert the fields TEXT 1 and Text 2 Fig 2:
  • PROGRAM *PGMMOD OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO DD/MM/YY
USER                TAB Sequence                        HH:MM:SS 
                             OOOOOOOOOOOOOOOOOOOO                              
Header OOOOOOOOOO Header Type O  HeadDescription                                 
Head Type Table number, press Enter. -     
                                         
                    Column1       column2         Column3       Column4     
Row1           1. -                          21. -     TEXT1                  
Row2     2. -                          23. -                        
     Head1 Head2      Head3  Head4
Row3    3. -          10.-            22. -          30.-            
     Head5 Head6      Head7  Head8 
Row4          4. -          11.-            24. -          31. -       
   
  Row5       5. -          12.-            25. -          32. -  TEXT2         
  Row6   6. -          13.-            26. -          33. -           
  Row7   7. -          14.-            27. -          34. -           
Row8                OOOOOOOOOOOOOOOOOOOOOOOOO                          
Constant Text 
Row10               OOOOOOOOOOOOOOOOOOOOOOOOO                             
Row11          OOOOOOOOOOOOOOOOOOOO    Value -----           
Date1 66/66/66    Date2 66/66/66    User OOOOOOOOOO           O 
F3=Exit F12-Previous
Note: In Fig 2 Text 1 and Text 2 fields are added and it will not be displayed in the screen while running the program. These are hidden fields
Field set up for TEXT 1 & Text 2: Fig 3:
EDIT SCREEN FIELD ATTRIBUTES     
Field . : Text 1                                                               
Field display attributes:                                                      
                    HI  UL  RI  CS  BL  ND Colour                              
*----->-Output......                     Y                                     
*-(1)-<-Input.......                     Y                                     
        Error.......         Y                                                 
        Entry.......                                                           
                                                                               
1. Convert Input field to Output field if the following                        
   condition is true:                                                          
                                                                               
   Ctx Field                     Condition                                     
                                                                               
                                                                               
2. Apply to field text also  . . . . . : Y                                     
                                                                               
                                                                              
                                                                               
                                                                                             
F3=Exit  F9=Field details                                                      
                                                                              

After do the set up the display sequence will be as follows:
Field Func Typ Usg Ovr Display seq Tab seq Column3 ROW1 (21) DTA REF I I 14.00 15.00 Text 1 USR TXT I I 16.00 16.00 Column1 Row2 (2) DTA REF I I 17.00 14.00
Column4 Row4 (31) DTA REF I I 36.00 20.00 Text 2 USR TXT I I 39.00 21.00 Column1 Row5 (5) DTA REF I I 40.00 9.00
In the above case, the display sequence skips but the TAB sequence is in ascending order. So we have only 5 cases will be the descending order TAB sequence with no continuation number in the Display Sequence
If we compile the code and the DDS source will be as follows.
DSPATR(MDT) CHECK(AB) FLDCSRPRG(Z1J3AT) OVRDTA DSPATR(PR) DSPATR(RI PC) DSPATR(ND) DSPATR(UL HI) COLOR(PNK) OVRATR
In this case FLDCSRPRG is generated for the field and also it will be generated for the rest of the fields. So the TAB sequence will be working as we expected.
Not a problem for the following cases:
The following case will not be a problem since the TAB sequence is in ascending order even though Display Sequence not continued for the input field.(Note Here DSP sequence 60.00 is continued after the DSP sequence number 59.00 for out put field.)
Case 1: Field Func Typ Usg Ovr Display seq Tab seq Row10 DTA STS I I 59.00 30.00 TEXTFLD USR TXT I O 60.00 Row11 DTA STS I I 61.00 31.00
Case 2: Field Func Typ Usg Ovr Display seq Tab seq ROW10 DTA STS I I 59.00 32.00 TEXTFLD USR TXT I O 60.00 ROW11 DTA STS I I 61.00 31.00

Conclusion:

Conclusion is either the Display sequence should continue for the input fields without skipping the sequence number OR the TAB sequence should be in the ascending order. In either of the cases are missed and if the TAB sequence is not working we can use the above mentioned technology to solve this issue. If we avoid using the constant we will not face this problem. But in some cases we have to use the constant for heading etc. In this case we can go for the above solution.

Maximum fields in CA 2E(SYNON) Functions

Introduction

In some applications lots of information needs to be displayed on a screen. But unfortunately character-based ("green screen") software/tools will not allow displaying all the information in a screen or in one page. It will allow only certain number of fields based on the limits of accommodation in the screen or maximum number of fields allowed in the software/tools/language. If we go beyond the limit it will be a problem.
The same case happens here in 2E. There are 132 fields were hidden and 99 fields were output in a DSPRCD Screen. As the implantation user wants to add a field in that DSPRCD screen and by pressing the key F4 on that field should display the related information in another screen.

Problem

In any screen, Detail record format will only allow maximum of 99 fields of input or output or input and output combination. Hidden fields are not a problem. If we try to add one more new field in the screen which is already having 99 input/output fields, we will not be able to compile the program. It will stick with the GENSRC and if we see the JOBLOG the following message will be displayed.
Message . . . . : FIXEDOVERFLOW at statement 525 in YCBLCSRK1I. ONCODE 310. Cause . . . . . : The receiver operand is too small to hold the result. The number of digits of the intermediate result of a fixed point arithmetic operation exceeds the maximum number of digits allowed by AS/400 PL/I. The maximum for intermediate results is 15 or 31 (depending on whether the compiler option *EXDDEC is used) for decimal fixed-point values and 31 for ……
The problem here is, the screen is reached the maximum number of indicators i.e. 99.If we define an input or output field more than that the source will not get generated because there is no indicator available to assign for those fields. If we try to give “G” Generate source against this function it will come out from the model and we will get the following message “The receiver operand is too small to hold the result” Requirement:” .Here while generating the source, internal source is checking the validation and comparison in its internal AllFusion 2E (SYNON 2E) Code which is available in YCBLCSR program and related files.
For Hidden fields, this is not a problem since these fields are not at all considered hence there is no need of indicators.

Requirements

But here the requirement is on the existing screen which is in production and it is a familiar screen for the business users. Because of one field, the client does not want to change the screen look (i.e. to go for another DSPRCD 2, or 3). If we go for DSPRCD 2 or 3 we need to split the fields in to across the screen. That will go for further implementation, and time consumption and also client needs the training on the new screen .Because the existing screen is there for a long time in production.

Requirement 1

Add a field in DSPRCD screens and that will high light that the current record is having the new functionality say for example “T”-Test (Fig1 highlighted in Blue)

Requirement 2

If “T” is displayed then user can take F4 and see the full details of Test in another screen.
Here adding input/output field is not allowing in screen due to compilation problem. We tried to concatenate some of the fields and we tried to add a field. This case compilation was not a problem but F4 was not working due to the indicator problem. How we can make a code for when F4 is pressed, since this also need an extra indicator (Code will generate an indicator for F4 pressed).So this solution also not helpful. So we will see how to solve this problem. Let us see in detail below.
DSPRCD for displaying all the information: Fig 1:
*PROGRAM   *PGMMOD OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO           DD/MM/YY 
User                 Test screen                      HH:MM:SS 
Row1  666666666666666 666 Date1 66/66/66 Date2 Dt 66/66/66 Type  OO 
Row2  OOOOOO    Field1  OOOOOOOOOO Field2 OOOOOOOOOOOOOOO   Field3 OO 
Row4: FLDl OO Field4 OOOOOOOOOOOOOOO Field5OOOOOOOOOOOOOOOOOOOOO Date666/66/66 
Row5: FLD2 O Field6 OOOOOOOOO FLD3OO Field7 66/66/66 FLD4 OOField8 666/666-666 
Row6   OOOOOOOOO Field9 OOOOOOOOOOOOOOO FLD5 OOOOOOOOOOOOOOO FLD6 OOOOOOOOOO   
Row7 OOOOOOOOOOOOOOOOOOOO Field10 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO        
Row8 OOO FLD7 O FLD8 O FLD9 66/66/6666 Price   Tot1      Tot2      Tot3   
Row9  FLD10 66/66/66 FLD11 66/66/66    Cal1 6666666.66 6666666.66- 6666666.66- 
Row10: OO FLD12 OOOOOOOOOOOOOOOOOOOO  Cal2 6666666.66 6666666.66- 6666666.66- 
Row11 OOOOOOOOOOOOOOOOOOOOOOO GenInd O Cal3 6666666.66 6666666.66- 6666666.66- 
Row12 OOOOOOOOOO FLD13 OOOOOOOOOOOOOO  Cal4 6666666.66 6666666.66- 6666666.66- 
Row13 66666 FLD14 66666666.666 FLD15OO Cal5 6666666.66 6666666.66- 6666666.66- 
Row14 666 FLD16 O FL1 O FL2 OOOOOOOOOO Cal6 6666666.66 6666666.66- 6666666.66- 
Row15 FL3 OO FLD16 OOOOOOOOOOO         Cal7 6666666.66 6666666.66- 6666666.66- 
Row16 FL4 OO FLD17 OOOOOOOOOOOOOOO     Cal8 6666666.66 6666666.66- 6666666.66- 
Row17 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Cal9 6666666.66 6666666.66- 6666666.66- 
Row18 FLD18 OO FLD19 OOOOOOOOOOOOOOOO Cal10 6666666.66 6666666.66- 6666666.66- 
Row19 O FL5 OOOOOOOOOOOOOOOOOOOOO     Cal11 6666666.66 6666666.66- 6666666.66- 
Row20 OOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO O O O O O O O O O         
Row21OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO  
Row22OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

Solution

To avoid the Compilation problem and full fill the user requirement we added a constant field as “O” and we noted the Cursor position of the field in the screen (Cursor row and cursor column).
Now we added the code in the Action diagram as follows. And the new functionality is also worked as per the new requirement and there was no compilation problem. In this case the cursor row is = 21 and the cursor column is = 55
Anyhow there will not be any big change in the screen structure i.e. fields locations in the screen and screen looks etc, If any screen changes in future then we have to note down the cursor Row and Column and need to change in the action diagram if we did the code for F4 functionality based on the cursor row and cursor column.
Action diagram Code:
USER: validate detail fields
Case DTL.CMDKEY is CF04
     IF *Cursor Row is Row (Defined as 21 is Row)
     IF *Cursor Column is Column (Defined as 55 is column)
/* Call the new functionality*/ 
END Case  
Note:
We can go and create a new screen or go for DSPRCD 2/3 and EDTRCD 2, 3 these all are the option .But nay existing screen and like the small one or two changes I feel this is a good method. IT will save the time /cost and no further training is needed for the End user or business user. Particularly some customers like our customer will not allow changing the new screen since they need time cost and need training for their clients.

Conclusion

Now we understand How the Constant Helped lot in the compilation problem and solved the new requirement. As discussed in the above cases we can use this constant technique to solve this kind of problems. We concatenate some text fields if they have any relations (Ex: First name, Second name ) then we can remove/Hide other field and we can insert a new field. But still if we have indicator problem like taking F4 we may need to go for constant technique.
 

AS400/RPG Help

As400 DataBASE
Q          What are the different definition levels in Data Description specifications ?
A          File level, Record level, Field level, Join level, Keyfield level, Select/Omit level.

Q          What is difference between Source Physical File and Physical File ?
A          A Source Physical File contains the source for the various objects created. This file has a specific structure. A Physical File contains data, and the record format can be different for different physical files.

Q          What is the difference between Physical and Logical files ?
A          Physical file contains data, where as Logical file serves as a access path to database.

Q          What is an access path ?
A          The order in which the database fields are organized for processing in the program.

Q          What are all the different types of access paths ?
A9        Arrival sequence access path,
                        Keyed sequence access path.

Q          How many record formats can you have in a Physical file and in a Logical file ?
A          Physical file can contain only one record format, Logical file can contain more than one record format.

Q          What is a field reference file ?
A                      A field reference file is a physical file which contains no data, contains field description. this is used as a reference file by other physical files.

Q          What is the default value for the number of increments for the physical file ?
A          Three.

Q          When is the DFT keyword in PF used for?
A          To specify the default value it a field.

Q          What is Multi-format logical file ?
A          Logical which uses fields from two or more physical files.

Q          What is dynamic select ?
A                      Selection and omission of  LF records performed during processing, instead of access path is maintained. This can be used when key access path does not exist.                         

Q          What is the Select and Omit criteria in logical file ?
A          This is used to specify rules for the Selection/Omission of records from a Physical File.

Q          Can fields be concatenated at the logical file level ?
A          Yes, by using CONCAT keyword.

Q          When would the ALL keyword be used ?
A          Use with Select or Omit, to select/omit records.

Q          What is a Join Logical File, Can it be used for Update ?
A          Logical file that combines more than one physical file.
                        Update is not possible through JLF.

Q          How many files can be joined at a time, What is the max. no. of files ?
A          At a time you can join two files. The max. no. of files is 32.
                        Only one primary file and the remaining are secondary files, The primary file and atleast one secondary file must be physical files.

Q          Is it possible to join the same file to itself ?
A          Yes.

Q          What is FCFO, FIFO, LIFO in Database environment ?
A                      These are file level keywords which are used to access the records in the order
                        FCFO : First Changed First Out
                        FIFO  : First In First Out
                        LIFO  : Last In Fist Out

Q                      If a file layout is changed, how do you generate new PF and retain data?
A                      Copy the file and change the structure of Physical file, later copy old file with drop option.

Q          What is the overhead on logical file ? How can it be improved ?
A                      Maintaining access path and storage space. We can improve the performance by using *DELAYED, *REBUILD keywords to enhance the speed.

Q          How can the sign of a numeric be ignored when sequencing a logical file ?
A          By specifying  the record level keyword UNSIGNED.

Q                      If a field references a field that has an EDTCDE or an EDTWRD keyword specified, can the EDTCDE or EDTWRD from the referenced field ignored ?
A          Yes, by using DLTEDT keyword.

Q          What does the keyword UNIQUE mean ?
A                      Records with duplicate key values are not allowed.

Q          State three different methods of maintaining access paths ?
A                      Immediate, Rebuild & Delay.


***********************

Q          How to start a CL program ?
A           PGM.

Q          How many files can be declared in CL ?
A           One.

Q          Which precedes, the file declaration or variable declaration ?
A           Variable declaration and then File declaration.

Q           What are the different types of variables available in CL ?
A           DEC, CHAR, LGL

Q          In CL Program '&' precedes ____ .
A           Variables.

Q          How do you pass parameters in CL ?
A           Using PARM keyword.

Q          Can libraries be added to the library list through CL ?
A          Yes, using  ADDLIBL.

Q           What is the difference between CAT, TCAT and BCAT ?
A           CAT   :  Concatenate two variables or constants into one continuous string.
                        BCAT :  Truncates all trailing blanks in the first character string ; one blank is inserted , then the two character strings are concatenated.
                        TCAT :  Truncates all trailing blanks in the first character string, the two character strings are concatenated.  

Q          How do you end a CL program ?
A          ENDPGM

Q           What are the different types of messages in CL ?
A           Immediate message, Break message, Program message, User message.

Q           How can errors be trapped in a CL program?
A           By using Monitor Message Command ( MONMSG )

Q          What is the maximum length of a variable name in CL ?
A           Maximum 11 characters (including '&')

Q           What are the limitations of CL (compare to RPG) ?
A          You cannot use CL program to :
                        .  ADD or UPDATE records in database files
                        .  Use Printer or ICF files
                        .  Use Program described files
                        .  Use the concept of subfile (to display more than one record), but a single output message subfile is   a special type of subfile that is supported well in CL
                        .  Use subroutines.
                        You cannot declare more than one object (file) in a CL programme.