Progress 4gl interview questions


Q:- What is the diff between for first and find first?

Ans:-  The difference between for first and find first is:
1. For is a progress block and find is a progress statement.
2. For first can use multiple indexes and Find cab use only one index.
3. For First fetch the data from record list and Find first fetch the data from record buffer.
4. Contain function cab be used by For First but not by Find First.
5. In for block u can use field clause, but in find statement u cant use field clause.
6. You cant use prev and next phrase with For block as like find statement.

for first displays data without sorting while find first display data after sorting,So the for first is more efficient in terms of time taken for displaying the record as compared to find first.
u can check this by using the ETIME() Function to check the time taken by these two 
statements.

Q:-  Is there a difference between a FIND and a FIND FIRST when the index is unique?

Ans:- Yes, there is a difference. Even if a unique index is used (either by our normal index selection process or by a USE-INDEX phrase) a FIND statement without the FIRST option goes through some extra code to determine whether multiple records match the WHERE clause criteria. In this scenario the extra time taken for the ambiguousness test may take a few milliseconds, however, if the FIND statement is inside a block that is executed many thousand (or hundreds of thousands of times) the cumulative effect of those 'few milliseconds' will quickly add up and may well be the root cause of what is perceived to be a poorly performing query.

Q:-  What is the diff between find and can-find?

Ans:-  1. find is a statement and can-find is a function.
     2. find returns the value as per where clause and can-find returns the logical value.
     3. In find statement u can define no-error but, in can-find u can't.
     4. In can-find u can't use the exclusive-lock, but in find u can
     5. In can-find u can't manipulate the data, but in find u can with exclusive lock.   
     6. Can-find is used only for data existence. if data is exist then it returns TRUE otherwise it returns     
          FALSE.
Q:- What is the diff bet a function and a procedure

Ans:-  1. function can return the value through the return keyword,but procedure can't return the value
     2. Procedure can be ab external procedure(.p,.w) but not function.
     3. Function can be defined inside the procedure , but procedure can't .
Q:- What is the diff between for first and find first?

Ans:-  The difference between for first and find first is:
1. For is a progress block and find is a progress statement.
2. For first can use multiple indexes and Find cab use only one index.
3. For First fetch the data from record list and Find first fetch the data from record buffer.
4. Contain function cab be used by For First but not by Find First.
5. In for block u can use field clause, but in find statement u cant use field clause.
6. You cant use prev and next phrase with For block as like find statement.

Q:- Diff b/w PUT, Set, Update and Display?

Ans:- PUT - is used to send/display the data except on terminal like printer, fax, any file etc.
      Set - is the combination of  Prompt-For + Assign. In set it directly update the data from record buffer to database.
      Update - is the combination of  Display + Prompt-for + Assign. In update statement it will display the previous value on screen buffer and ask to user to overwrite the new value which is to be updated, means data will move to from screen buffer to record buffer to database.
      Display - is used for take the data from record buffer to screen buffer, means display the data on screen.
Q:- In Progress How many Locks?

Ans:-  Progress support 3 locks
Share-Lock(default lock, other user can read but not update)
No-lock (other can only read)
Exclusive-lock (other cannot read and update)


Q:- Why we need Share-lock?

Ans:- To avoid the deadly embrace condition we need the Share-lock.
          Suppose in a database if there is any record which is being updated by user1 and same time user2 will also want to update that record then because of share-lock other user cannot update the record.


Q:- What is the use of defining the EXCLUSIVE-LOCK with NO-WAIT option??

Ans:-  FIND FIRST pp EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
           IF AVAILABLE pp THEN NEXT.
         In above example same time if other user also want to update the same record then other user will not have to wait to release the lock, user2 (progress) will find the no-wait clause and it will go for else part or next line of code.
        In above example if u doesnt mention the NO-WAIT clause and mean while if user1 has gone for some other work/tea, then user2 will hit the database every time to update the record, means progress will not move the next line of code until it will not get the release of exclusive-lock. So best programming practice is that whenever use the exclusive-lock also use the no-wait.
Q:- What is Transaction?

Ans:- Transaction is a set code which completely done the program or completely undone the program.
         A transaction is a unit of work that is either completed as a unit or undone as a unit.
         In transaction  we maintain the data integrity at database level.
        Data integrity means that Progress stores completed data and does not store incomplete data in the                                      
        database. Progress uses transactions to automatically handle this processing.
         We can define the transaction by-
DO TRANACTION
DO ON ERROR UNDO/ RETRY/ LEAVE
REPEAT 
For EACH
PROCEDURE



Q:-      Progress Creates how many file at the time of database creation?

ANS:- Progress Creates 5 log files at the time of database creation-
    1. .db (database file)
    2. .st (structure file)
    3. .lk (lock file, if this file is available means database is up)
    4. .b1 (data extension)
    5. .d1 (data extension)
    6. .lg (time of database up and shut down)
Q:-  How many blocks in Progress?
Ans:- In Progress there are 6 blocks-
Procedure Block
Trigger block
For Each Block
Repeat Block
Do Block
Editing Block
Q:- What does the following functions ?
  lookup
  entry
  can-do
  num-entries
  R-index
  index

ANS:- 1.Lookup Function  - Returns an integer giving the position of an expression in a list. Returns a 0 if the expression is not in the list.
      SYNTAX --   LOOKUP ( expression , list [ , character ] )   
Entry Function - Returns a character string entry from a list based on an integer position                               SYNTAX :- ENTRY ( element , list [ , character ] )
Can-do function :- Checks a string value against two types of comma-separated lists:
                          An ID list of one or more user permission strings that indicate what users have access to the current procedure. The function returns TRUE if the specified user ID has access according to the list. 
SYNTAX:- CAN-DO ( id-list [ , string ] ) 
. NUM-ENTRIES function:- Returns the number of items in a list.  
                                                SYNTAX:- NUM-ENTRIES ( list [ , character ] ) 
. R-index function:- Returns an integer that indicates the position of the target string within the source string. In contrast to the INDEX function, R-INDEX performs the search from right to left and when it found the target then it count from left to target position.
SYNTAX:- R-INDEX ( source , target [ , starting ] )
. Index function:- Returns an integer that indicates the position of the target string within the source string.It start the searching from left to right.If target is not defined in source then it will return 0.
Q:-  Is there a difference between a FIND and a FIND FIRST when the index is unique?

Ans:- Yes, there is a difference. Even if a unique index is used (either by our normal index selection process or by a USE-INDEX phrase) a FIND statement without the FIRST option goes through some extra code to determine whether multiple records match the WHERE clause criteria. In this scenario the extra time taken for the ambiguousness test may take a few milliseconds, however, if the FIND statement is inside a block that is executed many thousand (or hundreds of thousands of times) the cumulative effect of those 'few milliseconds' will quickly add up and may well be the root cause of what is perceived to be a poorly performing query.
Q:- Types of Buffers?

Ans:- Progress provides you with one buffer for each table that you use in a procedure. Progress uses that buffer to store one record at a time from the table as the records are needed during the procedure. If you need more than one record at a time from a table, you can use the DEFINE BUFFER statement to define additional buffers for that table. If you need to share buffers among procedures, use the DEFINE SHARED BUFFER statement.
  
    Progress supports 2 types of buffers.
 1. Record buffer:- A temporary storage area in data memory for a record, field, or variable. When you read a record from the database, Progress makes it available to your application in the record buffer. When you write a record to the database, Progress gets that record from the record buffer.
 2. Screen Buffer:-  to display the data on screen from record buffer.

What is the difference between Variable, Parameter, and Argument?
Ans:- Argument:- U can pass the argument at compile time. 
A constant, field name, variable name, or expression that you want to pass as a compile-time argument to the external procedure you are running. 
When you pass arguments to an external procedure, Progress converts those arguments to character format. Progress recompiles the called procedure, substitutes arguments, and then runs the procedure. You cannot precompile  a procedure to which you pass arguments. (If you use shared variables instead of arguments, the procedure can be precompiled. This yields more efficient code.) 
Parameter:- U can pass the parameter at run time.
Q:-  What is difference between  STREAM  , OUTPUT TO, and  OUTPUT TO VALUE? 

ANS:- By Defining the STREAM you can send the data(output) to more than one destination at a time by single stream name.
By Defining the OUTPUT TO you can send the data to predefined file name and only one destination at a time.
By Defining the OUTPUT TO VALUE you can send the data to dynamically change the file name and only single destination at a time.  

Q:-  What is the diff between find and can-find?

Ans:-  1. find is a statement and can-find is a function.
     2. find returns the value as per where clause and can-find returns the logical value.
     3. In find statement u can define no-error but, in can-find u can't.
     4. In can-find u can't use the exclusive-lock, but in find u can
     5. In can-find u can't manipulate the data, but in find u can with exclusive lock.   
     6. Can-find is used only for data existence. if data is exist then it returns TRUE otherwise it returns     
          FALSE.
Q:- What is the diff bet a function and a procedure

Ans:-  1. function can return the value through the return keyword,but procedure can't return the value
     2. Procedure can be ab external procedure(.p,.w) but not function.
     3. Function can be defined inside the procedure , but procedure can't .
Q:- What is the diff between for first and find first?

Ans:-  The difference between for first and find first is:
1. For is a progress block and find is a progress statement.
2. For first can use multiple indexes and Find cab use only one index.
3. For First fetch the data from record list and Find first fetch the data from record buffer.
4. Contain function cab be used by For First but not by Find First.
5. In for block u can use field clause, but in find statement u cant use field clause.
6. You cant use prev and next phrase with For block as like find statement.
Q:- Can you define a variable with same name both inside and outside a procedure?

Ans:-  YES.
 NEW SHARED VARIABLE variable-name 
Defines and identifies a variable to be shared by a procedure called directly or indirectly by the current procedure. The called procedure must name the same variable in a DEFINE SHARED VARIABLE statement. 

NEW GLOBAL SHARED VARIABLE variable-name 
Defines and identifies a variable that can be used by any procedure that names that variable using the DEFINE SHARED VARIABLE statement. The value of a global shared variable remains available throughout an OpenEdge session. 

SHARED VARIABLE variable-name 
Defines and identifies a variable that was created by another procedure that used the DEFINE NEW SHARED VARIABLE or DEFINE NEW GLOBAL SHARED VARIABLE statement. 
[ PRIVATE | PROTECTED | PUBLIC ] VARIABLE variable-name

Q:-  Progress supports how many types of variable?

Ans:-  Progress supports 12 types variable:
     1. Integer 
     2. Character
     3. Decimal
     4. Logical
     5. Rowid
     6. Recid
     7. Memptr
     8. Date
     9. Handle
     10.com-handle
     11.Widget-handle
     12.Blob  (open edge-- for saving the images)
     13.Clob  (open edge-- for saving the images)

Q:- Why do we use the TEMP-TABLE?

Ans:- 1.  We use the temp table in client server architecture. By using the temp table we can reduce the     network traffic on server to DB.
Suppose u have a database and that database is used by 100 client and user1 want to update the table with 100 fields,
 If u define the temp table then first we update the data into temp table then from temp table with one shot we can update all changes to database directly, mean while at the time of temp table updation,  other user can use the same table, means we have reduces the network traffic and reduces hitting of db table.
If u doesnt define the temp table and u need to update the 1laks records in database then in that case u r hitting the database every time for updating the records and u keeps busy the network traffic also. Means  same time other user can not use that db table. 
2. The other use of temp-table is u can assign the data from single temp-table to multiple database tables at on shot.

Q:- Diff b/w PUT, Set, Update and Display?

Ans:- PUT - is used to send/display the data except on terminal like printer, fax, any file etc.
      Set - is the combination of  Prompt-For + Assign. In set it directly update the data from record buffer to database.
      Update - is the combination of  Display + Prompt-for + Assign. In update statement it will display the previous value on screen buffer and ask to user to overwrite the new value which is to be updated, means data will move to from screen buffer to record buffer to database.
      Display - is used for take the data from record buffer to screen buffer, means display the data on screen.
Q:- In Progress How many Locks?

Ans:-  Progress support 3 locks
Share-Lock(default lock, other user can read but not update)
No-lock (other can only read)
Exclusive-lock (other cannot read and update)


Q:- Why we need Share-lock?

Ans:- To avoid the deadly embrace condition we need the Share-lock.
          Suppose in a database if there is any record which is being updated by user1 and same time user2 will also want to update that record then because of share-lock other user cannot update the record.


Q:- What is the use of defining the EXCLUSIVE-LOCK with NO-WAIT option??

Ans:-  FIND FIRST pp EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
           IF AVAILABLE pp THEN NEXT.
         In above example same time if other user also want to update the same record then other user will not have to wait to release the lock, user2 (progress) will find the no-wait clause and it will go for else part or next line of code.
        In above example if u doesnt mention the NO-WAIT clause and mean while if user1 has gone for some other work/tea, then user2 will hit the database every time to update the record, means progress will not move the next line of code until it will not get the release of exclusive-lock. So best programming practice is that whenever use the exclusive-lock also use the no-wait.
Q:- What is Transaction?

Ans:- Transaction is a set code which completely done the program or completely undone the program.
         A transaction is a unit of work that is either completed as a unit or undone as a unit.
         In transaction  we maintain the data integrity at database level.
        Data integrity means that Progress stores completed data and does not store incomplete data in the                                      
        database. Progress uses transactions to automatically handle this processing.
         We can define the transaction by-
DO TRANACTION
DO ON ERROR UNDO/ RETRY/ LEAVE
REPEAT 
For EACH
PROCEDURE
Q:- What is Preprocessor in Progress?
Ans:-  The preprocessor is a component of the Progress Compiler. Before the Compiler analyzes your source code and creates r-code, the preprocessor examines your source code and performs text substitutions.You control the preprocessor by placing preprocessor directives throughout your source code. A preprocessor directive is a statement that begins with an ampersand (&) and is meaningful only to the preprocessor.
Procedure is the largest Progress unit of execution, consisting of one or more Progress source or r-code statements in a single, outer block. 

There are two types of procedures: External & Internal.

External Procedures 
It is the most basic procedure, which can contain a single 4GL statement, many statements, or it can be an empty file.
It can be created, stored and compiled separately from all other procedures as an operating system file. It can execute by name using the RUN statement. 
There are two types of external procedures persistent and non-persistent.
Internal Procedures : 
It is a block of code defined within an external procedure that you can execute by name within the context of the containing external procedures.
It allows you to modularize your code and reduce the number of external files in an application.
A single external procedure (.p or .w) can contain any number of internal procedures.
What is the difference between Persistent and Non-Persistent Procedures?
Non-Persistent Procedure maintains and creates its context only it returns from execution. The scope remains only until the RUN statement that executes it completes. This is the default external Procedure.
Persistent Procedure creates it context when it executes and then maintains it context after it runs until the end of the progress session, or until it explicitly deleted. The scope remains after the RUN statement executes and it completes until you remove it.
Trigers
A Trigger is a block of 4GL code that executes whenever a specific database event occurs.

PROGRESS supports 2 types of database triggers:
Schema Trigger
Session Trigger

Schema Triggers
Session Triggers

Are independent procedures.
Contained in a larger procedure.

Always execute when a specified event occurs, regardless of what application initiates the event.
Defined as part of an application and are only in effect for that application.

Are compiled separately from the procedure that initiates their execution, they do not have access to the procedures frame, widgets and variables.
Have access to the frames, widgets, and variables defined in the enclosing procedure.

Used for processing specific even which always has to be performed. Eg deletion of sod_det where so_mstr is deleted.
Used for performing additional or independent processing when the even occurs.

Maintenance - Add / Modify / Delete database record
Inquiry - Simple formatted extract without batch id option
Report - Detail formatted extract with batch id option with 
                  report header and trailer
CIM - Data Upload
Trigger - Event driven programs
Window Helps - To view existing 

{mfdtitle.i} - Display title information
{mfdeclre.i} - Title information in called programs
{mfselprt.i} - Printer selection without Batch ID
{mfselbpr.i} - Printer selection with Batch ID
{mfphead.i} - Report Header
{mfquoter.i} - Passing batch parameters
{mfreset.i} - Close printer stream
{mfrpexit.i} - To enable ctrl-break feature
{mfrtrail.i} - Report Trailer
{pxmsg.i} - Display Message

CIM Programs

Features :
Load data through online maintenance programs.
All validation used in these programs during normal data entry is available during a CIM load.
All relevant tables associated with the online maintenance are updated correctly. 
All character fields should be enclosed in quotes ().
Simulation of keystrokes are as follows:

Please give a brief about no-undo and undo option.

NO-UNDO:
When the value of a variable is changed during a transaction and the transaction is undone, Progress restores the value of the variable to its prior value. If you do not want, or if you do not need, the value of a variable to be undone even when it has been changed during a transaction, use the NO-UNDO option with the DEFINE VARIABLE statement. NO-UNDO variables are efficient; use this option whenever possible.
Specifying NO-UNDO for a variable is useful if you want to indicate an error condition as the value of the variable, perform an UNDO, and later take some action based on that error condition. If one variable is defined LIKE another that is NO-UNDO, the second variable NO-UNDO only if you specify NO-UNDO in the definition of that second variable.

UNDO:
Indicates that the specified block is undone. If you do not specify the UNDO option, then the current transaction is committed when the QUIT statement is executed.

What is the difference between Temp-Table and Work-Table?

Temp Table 
 Work Table

When we define temp table with like option index will inherit the index information from the database table.
It dont have index support

Records are stored temporarily on disk
Records are stored in memory

Temporary tables can be passed as parameters to procedures
We cant pass as parameters

Record access will be fast sequential and random access search
Work tables have no index support, all access is performed with a sequential search


Why do we use index? What are the types of Indexes?
Index A directory or table is containing the field or fields identifying the records in a table, and the locations where the records are stored. It allows you to search the records in very fast manner.
Primary index, unique index, Word Index
Primary Index  Usually the most frequently used index. Progress allows you to set one index as primary and uses it by default when retrieving or ordering records.

How do you set the PROPATH?
Progress contains an environment variable called PROPATH which contains a list of directories that progress searches to find procedures.
Example: PROPATH= PROPATH  +  ",/dlc,/dlc/proguide,/dlc/appl1/procs"
Purchase Requisition (Requisition or Blanket Order)
Purchase Order 
Purchase Order Approval
Purchase Order Print [ORD-PO]
Purchase Order Receipt [RCT-PO]
Inventory Debited
To POR Credited 
If QC Ok then Make APV otherwise Purchase Return.
On Return [ISS-RV]
POR Debited
To Inventory Credited.
Voucher Confirmation.
POR Debited
To Sundry Creditor Creditor
Cash/Bank Payment.
Sundry Creditor Debited
To Cash/Bank Credited.
If payment is made through bank
Cheque Print. Cheque cancellation 

What are the different types of purchase order available in Mfg/Pro?
Ans: Three type of Purchase Order are there in MFG/PRO:
Discrete purchase orders
 Blanket purchase orders
 Supplier schedules

What is Discrete Purchase Order?
Ans: Use these for single transactions with a supplier, where there is no assumption that further transactions will occur. Purchase orders contain a single delivery date for each line item. MRP treats purchase order items as supply, and assumes that ordered amounts will be available on the delivery date. Receipts can be processed against these purchase orders.

What is blanket Order?
Ans: Use these for multiple deliveries of stock items, where an ongoing relationship with the supplier is assumed, but exact delivery dates are yet to be determined. Quantities and due dates can be entered up to the time when a blanket order becomes a purchase order. Purchase order no need to approved again n again. As n vn u want  recurring = exact qty. qty can be ieregular


Does MRP consider Blanket Order?
Ans: MRP ignores blanket orders, and receipts cannot be processed against them.

What is Schedule order and explain its Process cycle?
Ans: A supplier schedule is an agreement with a supplier that guarantees a specified order level. Supplier schedules specify dates and even hours of delivery for the near term, and inform MRP and the supplier about long-term plans.
Process cycle Refer to Q # 1.
Explain Sales Cycle?
Ans: Sales Cycle Covers:
a. Sales Quotations:
 Respond to a customers request for a quote
 Monitor a quotes status
 Easily release a quote to an order, copying relevant data
 Provide visibility on potential gross margin contribution
 Provide quote history by item number or customer
 Generate reports on expired quotes that did not result in customer orders
b. Sales Orders:
 Create a sales order
 Verify Credit
 Confirm the order
 Determine whether inventory is available to promise on the due date
 Allocate needed inventory
 Print the Sales Order and Picklist   (Lad_det)
 Ship    (Inv Cr/ COGS DR.)
 Invoice Print   (AR DR/ Sales acc CR)
 Post the invoice    (in_mstr)
So_mstr, sod_det,-----------( ih_hist, idh_hist gl_tr_hist, glt_det

In AR AR CR/ Cash Bank DR)


Simple Questions

What is Progress 4GL?
Progress 4GL is an application development language which has a highly readable syntax employing a default behavior while performing the work of multiple 3GL statements.
PROGRESS gives you the ability to deploy your applications across a wide range of platforms and configurations -- host-based and client/server environments, open and proprietary systems, and character and graphical interfaces -- without changing the application logic.

What are the different PROGRESS data types?
Character, Date, Decimal, Integer, RowID, RecID, Raw, Logical, Handle, MEMPTR

What is the difference between LIKE and AS while defining a variable?
LIKE option - Indicates the name of the variable, database field, temporary table field, or work-table field whose characteristics you want to use for the variable you are defining.
AS option - indicates the data type of the variable you are defining.

Explain the concept of Buffer.
Progress uses that buffer to store one record at a time from the table as the records are needed during the procedure. If you need more than one record at a time from a table, you can use the DEFINE BUFFER statement to define additional buffers for that table. If you need to share buffers among procedures, use the DEFINE SHARED BUFFER statement.
The default buffers in progress are Data Buffer, Record buffer, Screen Buffer, Edit Buffer which are mainly used for input output operation.
Record Buffer - A temporary storage area in data memory for a record, field or variable. When you write a record to the database, Progress gets that record from the record buffer.
Screen Buffer  A display area for a field, variable or the result of a calculation. When you prompt for information or display information for the user, Progress places that information in the screen buffer.

What is a block? What are the different types of Blocks?
A Block is a series of 4GL statements grouped together and treated as a single unit. Typically each block begins with the header statement and ends with the END statement.
Types of blocks are:
Procedures 
Triggers
Control Blocks
Do
Repeat
FOR EACH 

What is the difference between Begins and Matches Operator?
Begins
Matches

Tests a character expression to see if that expression begins with a second character expression.
Compares a character expression to a pattern and evaluates to a TRUE value if the expression satisfies the pattern criteria.

BEGINS is useful in a WHERE phrase that specifies which records should be retrieved in a FOR EACH block. BEGINS uses an index wherever possible.
MATCHES does not use index information when performing a comparison; it always scans the entire data table.


Define Break by option with one example.
When used in combination with the FIRST function, LAST function, FIRST-OF function, and LAST-OF function, BREAK indicates that subgroups are used for aggregation. If you use BREAK, you must also use BY.

BY expression [DESCENDING] 

Sorts the pre-selected records by the value of expression. If you do not use the BY option, PRESELECT sorts the records in order by the index used to extract the records. The DESCENDING option sorts the records in descending order as opposed to the default ascending order.

Example: FOR EACH customer BREAK BY sales-rep BY country:
   IF LAST-OF(sales-rep) THEN DO:
      DISPLAY sales-rep ACCUM TOTAL balance
   END.
END.

What do you mean by new global shared, new shared variable and Shared Variable?
New shared Variable - Defines a variable to be shared by a procedure called directly or indirectly by the current procedure. The called procedure must name the same variable in a DEFINE SHARED VARIABLE statement.
New Global Shared Variable - Defines a variable that can be used by any procedure that names that variable using the DEFINE SHARED VARIABLE statement. The value of a global shared variable remains available throughout a Progress session.  
Shared Variable - Defines a variable that was created by another procedure that used the DEFINE NEW SHARED VARIABLE or DEFINE NEW GLOBAL SHARED VARIABLE statement.

Please give a brief about no-undo and undo option.

NO-UNDO:
When the value of a variable is changed during a transaction and the transaction is undone, Progress restores the value of the variable to its prior value. If you do not want, or if you do not need, the value of a variable to be undone even when it has been changed during a transaction, use the NO-UNDO option with the DEFINE VARIABLE statement. NO-UNDO variables are efficient; use this option whenever possible.
Specifying NO-UNDO for a variable is useful if you want to indicate an error condition as the value of the variable, perform an UNDO, and later take some action based on that error condition. If one variable is defined LIKE another that is NO-UNDO, the second variable NO-UNDO only if you specify NO-UNDO in the definition of that second variable.

UNDO:
Indicates that the specified block is undone. If you do not specify the UNDO option, then the current transaction is committed when the QUIT statement is executed.

What is the difference between Temp-Table and Work-Table?

Temp Table 
 Work Table

When we define temp table with like option index will inherit the index information from the database table.
It dont have index support

Records are stored temporarily on disk
Records are stored in memory

Temporary tables can be passed as parameters to procedures
We cant pass as parameters

Record access will be fast sequential and random access search
Work tables have no index support, all access is performed with a sequential search


What do you mean by Transaction?
A transaction is a set of changes to the database, which the system either completes or discards, leaving no modification to the database.

What is preprocessor directive? Name the Preprocessor directives.
A preprocessor directive is a statement that begins with an ampersand and is meaningful only to the preprocessor.
&GLOBAL DEFINE and &SCOPED DEFINE directives allows you to define preprocessor names, which are compile time constants.

Why do we use index? What are the types of Indexes?
Index A directory or table is containing the field or fields identifying the records in a table, and the locations where the records are stored. It allows you to search the records in very fast manner.
Primary index, unique index, Word Index
Primary Index  Usually the most frequently used index. Progress allows you to set one index as primary and uses it by default when retrieving or ordering records.
Unique Index - An indexed field where every index key must be different. For example, Social Security number could be a unique index.
Word Index - An index that contains all the words from a text field or array of text fields so you can search for records containing specific words or phrases.           

What are types of locks? What will be the lock when we read the record and update the record? What is the default lock? 
Shared-Lock, Exclusive-Lock, No-Lock       
Progress automatically puts a SHARE-LOCK on a record when it is read and automatically puts an EXCLUSIVE-LOCK on a record when it is updated.
Default Lock is Share- LOCK

What is deadlock? How will you avoid that?
A deadlock occurs when two or more users are waiting for data locked by each other. When this happens, these users are stuck (deadly embraced) and cannot continue processing.
Multi-table deadlocks can be avoided by locking the tables in same order in all applications, thus preventing a deadlock condition.

Tell about ENTRY Function with one example?
ENTRY - Returns a character string entry from a list based on an integer position.
Example:  Entry (3,Progress:RDBMS:MfgPro:Database,:)  = MfgPro.

Explain LASTKEY Function.
Returns the integer key code of the most recent event read from the user (that is, from the keyboard or mouse) during an interaction with a procedure.

Define Input Parameter, Output Parameter and Input-Output Parameter?
INPUT PARAMETER - Defines a parameter that gets its value from one of the following sources:
If the calling procedure runs the current (called) procedure synchronously, the value comes from the corresponding INPUT parameter of the RUN statement.
If the current procedure is the event procedure specified to handle the PROCEDURE-COMPLETE event for an asynchronous remote procedure, the value comes from the corresponding OUTPUT or INPUT-OUTPUT parameter of the remote procedure.
OUTPUT PARAMETER - Defines a parameter that returns a value to one of the following destinations:
If the calling procedure runs the current (called) procedure synchronously, the value is returned to the corresponding OUTPUT parameter of the RUN statement in the calling procedure.
If the calling procedure runs the current (called) procedure as an asynchronous remote procedure, the value is returned to the corresponding INPUT parameter of the event procedure specified to handle the PROCEDURE COMPLETE event for the current procedure.
INPUT-OUTPUT PARAMETER - Defines a parameter that receives an initial value passed from the calling procedure that can be subsequently modified by the called procedure. The calling procedure cannot pass a literal value. The called procedure returns the modified value to one of the following destinations:
If the calling procedure runs the current (called) procedure synchronously, the value is returned to the corresponding INPUT-OUTPUT parameter of the RUN statement in the calling procedure.
If the calling procedure runs the current (called) procedure as an asynchronous remote procedure, the value is returned to the corresponding INPUT parameter of the event procedure specified to handle the PROCEDURE COMPLETE event for the current procedure.    

How do you set the PROPATH?
Progress contains an environment variable called PROPATH which contains a list of directories that progress searches to find procedures.
Example: PROPATH= PROPATH  +  ",/dlc,/dlc/proguide,/dlc/appl1/procs"

Explain about Output To statement?
The output to statement is your tool for redirecting the default stream to another destination. It will change the output destination in a procedure; the output goes to that destination until you close it with the output close statement, or until you name a new output destination.

What is the difference between Find first and For First Statement?
You can use fields () attribute that allows you bring the selected fields of the table.

Medium Questions

What is a trigger and what are the different types of triggers?
A trigger is a block of 4GL code that executes whenever a specific event occurs.
There are two types of triggers:
Database trigger - Also known as a schema trigger, a block of 4GL code that executes whenever a specific database event occurs such as creating or deleting a table, assigning a value to a field, and so on.
User interface trigger - A block of 4GL code associated with an event-object pair. An action the user initiates on an object with a keystroke or a mouse--such as pressing the GO key or marking an object--executes a user interface trigger.

What is an Include file? Can we pass an include file as an argument to another include file?
An Include file is a separate file containing progress code that you can call from other procedures by placing the filename in braces within the procedure. Include files have an .i extension. You can use the name of an include file as an argument to another include file.  For example, a reference to {{1}} in an include file causes Progress to include the statements from the file with the name that passed as the first argument.

Can we compile an include file?
We cannot compile an include file. It is depending on the logic build in the include file. Include file can be compiled in case of the code built inside can execute independently.

What is the difference between Persistent and Non-Persistent Procedures?
Non-Persistent Procedure maintains and creates its context only it returns from execution. The scope remains only until the RUN statement that executes it completes. This is the default external Procedure.
Persistent Procedure creates it context when it executes and then maintains it context after it runs until the end of the progress session, or until it explicitly deleted. The scope remains after the RUN statement executes and it completes until you remove it.

Does internal procedure create .r file during execution?
No, only external Procedures will create .r file during execution and can have more than one Internal Procedures.

What is the difference between Procedures and Functions?
Procedures
Functions

The largest Progress unit of execution, consisting of one or more Progress source or r-code statements in a single, outer block.
Defines or forward declares a user-defined function.

Procedure doesnt return any value
Function will return single value to the caller




What is record scope? Brief us about strong scoped and weak scoped Reference.
The scope of the record is the nearest enclosing block that encompasses all the references to the record. That is, the record is active until the block ends. So the scope of the record is the portion of the procedure where that record buffer is active.

Strong Scoped Reference  if the buffer is strong scoped then you cannot reference that buffer in a containing block .The buffer is always scoped to the strong scope block.
Weak Scoped Reference - if you have weak scope referenced buffer, you can reference that same buffer outside the weak scoped block.

Why does progress use frames? What are the types of frames?
Progress uses frames to ease the task of laying out your data, so that you do not have to individually position every field in widget that you want to display.
There are two types of frames: down and one-down.
One-down frame displays single iterations of data and down frames displays multiple iteration of data.

If frame A is scoped to the Procedure block then will the scope of frame A be available throughout the entire procedure?
Yes, If it is scoped to the procedure Block then you can display the data in the frame from anywhere in the procedure.

When does PROGRESS upgrade the Shared-lock to an Exclusive-Lock?
The update statement let you make changes to the record and progress upgrades the shared-lock to an Exclusive Lock. This lock remains until the end of the transaction, which may be the end of Repeat Block.

What is can-find function? Can we use it in the where clause?
Returns True value if a record is found that meets the specified find criteria, else it returns false. It does not make record available to the procedure. We cannot use it in where clause, doing so generates error.

Brief about LOOKUP function? What will it return if expression is not in the list?
Returns an integer giving the position of an expression in a list. It returns 0 if the expression is not in the list.

Can we use the ACCUMULATE Statement without using blocks?
You can use the ACCUMULATE statement only in blocks with the implicit looping property. Progress automatically supplies looping services to REPEAT and FOR EACH blocks

What is the EDITING Phrase?
Identifies the process that follows each keystroke during a PROMPT-FOR, SET, or UPDATE statement. Therefore, to examine a value supplied by the user (within an EDITING phrase), you must use the INPUT function to refer to the field or variable that contains the value.
Example: 
DEFINE VARIABLE i AS INTEGER.

UPDATE i EDITING:
  READKEY.
  APPLY LASTKEY.
END.

What is the use of RECID and ROWID Data type?
It allows you to retrieve a pointer to a fetched record. You can use this pointer to:
Position to and retrieve a record from a results list.
Re-fetch record and modify its lock status.
Store as a future record reference.

What is the difference between ENABLE and VIEW Statement?
ENABLE  Enables input for one or more field-level and child frame widgets within a frame.
If you invoke the ENABLE statement for a frame, Progress brings the frame into view unless the HIDDEN attribute for the frame or one of its ancestor frames or windows is TRUE.
VIEW - Displays a widget (sets its VISIBLE attribute to TRUE). When you view a frame, that frame and all widgets contained within it are displayed except those widgets whose HIDDEN attributes are set to TRUE.

What is a Query? How do you find the end of its results list?
A query is a request for information from a database. It is a set of database records that you create with your procedures. A query can involve one or more tables and can consist related records from FOR EACH Statement.
QUERY-OFF-END Function - Returns a logical value indicating whether the specified query is positioned at the end of its result list (either before the first record or after the last record).

What do you mean by Widget, what are its attributes and types of Widgets?
A Widget is an object that provides visual and interactive capabilities for a progress application. A widget is a 4GL aware control that shares common capabilities with other controls of the same type defined in the 4GL.
Widget types are starting with windows. Windows contain frames and dialog boxes. Frames and dialog boxes contain field groups, and field groups contain field-level widgets or other frames.
Widget attributes  Characteristic of the widget such as type, screen location, size, color, font and relationship to other widgets.

What is normalization? Why do we normalize database?
Normalization is a design technique that is widely used as a guide in designing relational databases. Normalization is essentially a two step process that puts data into tabular form by removing repeating groups and then removes duplicated data from the relational tables. 
Normalization theory is based on the concepts of normal forms. A relational table is said to be a particular normal form if it satisfied a certain set of constraints. There are currently five normal forms that have been defined. 
You normalize a database in order to ensure data consistency and stability, to minimize data redundancy, and to ensure consistent update and maintainability of the data, and avoid update and delete anomalies that result in ambiguous data or inconsistent results.

Explain PUT Statement? What will UNFORMATTED option do in the PUT Statement?
Sends the value of one or more expressions to an output destination other than the terminal.  
UNFORMATTED - Tells Progress to display each expression in the same format produced by the EXPORT statement, but without quotes.

What will you write in the CIM program to specify F1, F4 key, Enter and for Default option?
F1 key  Skip F4 key  dot (.)
ENTER  SPACE Default - Dash (-)

What is the difference between Prompt-For statement and Set Statement?
Prompt-for statement only accepts the input and stores it in the screen buffer. The underlying record buffer of a field or variable is unaffected. When the procedure is run, the Prompt-For statement puts data into those fields.
The Set Statement accepts the input and then puts the data in the screen buffer name and in the specified fields or variables. It is a combination of 
Prompt-for  moves the user input to the screen buffer. 
Assign moves the data from screen buffer to record buffer.

How do you sort records with the use-index option?
The use-index option of the record phrase allows you to choose the defined index by which you want to access the selected records. Since find does not support by, use index comes in handy to sort the records   and it makes clear to which of the defined indexes to use for the sort order.



Tough Questions

Is Progress an SQL-based language?
No.  Progress certainly supports SQL, but the Progress 4GL and SQL are two different things.  Progress has the ability to use and understand SQL, but the overwhelming majority of application development is done using the native 4GL, which is held in high regard because it gives programmers the power that SQL has historically lacked, and that products like Oracle's PL/SQL and Power builders Transact/SQL attempt to provide with varying degrees of success.

What are the 4 ways to connect a Database?
As an argument when starting progress
With the CONNECT statement (in the Progress Procedure Editor or in a Progress Procedure)
With the Progress Data Dictionary.
Using the auto-connect feature.

Can we define the same NEW SHARED variable in Multiple Procedures?
If an application with several procedures defines a NEW SHARED variable with the same name in each procedure, Progress creates a different instance of the NEW SHARED variable in each procedure. This behavior supports recursive procedures and bill-of-materials applications. So, "NEW SHARED Variables with the Same Name in Multiple Procedures" is possible.

When I pass Temp table as parameters, what are the rules apply to Temp table parameters?
The calling procedure and the called procedure must have separate temporary tables.
The calling procedures temp table and the called procedures temp table must match with respect to the number of columns, the data type of each column, and the number of extents of each column.
The calling procedures temp table and the called procedures temp table need not have matching indexes.
At data movement time, Progress overlays any existing data in the receiving temp table unless you define the receiving temp table with the APPEND option. If you use the APPEND option, Progress appends the incoming data to the existing data.

Is it necessary to use a READKEY Statement in the EDITING Phrase? If yes, Why?
Yes, A READKEY statement does not have to be the first statement after the word EDITING. However, it should appear somewhere in the EDITING phrase because Progress does not automatically read keystrokes when you use an EDITING phrase.

Can we run an internal procedure with the persistent option?
You cannot run an internal procedure with the PERSISTENT option.

How do you redirect the output?
The STREAM-IO option allows you to redirect the output of a report-generating procedure to a printer or text file. This option removes the graphical components of your data. You can also redirect output to multiple destinations, and you can define multiple streams.


Why would you use PUT instead of DISPALY?
For every DISPLAY statement, Progress needs a frame. TO execute a DISPALY statement, Progress builds a frame capable of handling the expected output, using default services and your explicit instructions, simply outputs data one line at a time, with no default formatting. DISPLAY is most useful when you want automatic formatting. PUT is most useful when you want complete control over output.

Explain SEARCH function. What will return if search does not find the file?
Searches the directories and libraries defined in the PROPATH environment variable for a file. The SEARCH function returns the full pathname of the file unless it is found in your current working directory. 
If SEARCH does not find the file, it returns an unknown value (?).  
Syntax: SEARCH (filename).

What is the use of Batchrun in the CIM file?
If an error is encountered during the execution of the loop, it will help to come out of the loop by setting Batchrun parameter to Yes.

Explain the data moves between the calling procedure and the called procedure depending on the Parameter type. Say for INPUT, OUTPUT and INPUT-OUTPUT parameter.

INPUT Parameter data moves from the calling procedure to the called procedure
OUTPUT parameter data moves from the called procedure to the calling procedure 
INPUT-OUTPUT parameter data moves from the calling procedure to the called procedure, then back to the calling procedure. 
Some parameters send data, receive data, based on parameter type.

What  are the different locks used?
NO-LOCK EXCLUSIVE LOCK AND SHARED LOCK
Explain each types of locks?
No Lock allows you to read the table only and does not allow you to modify it. No lock is useful in reporting purposes. Others users can modify the data of the table which is no-locked using exclusive-lock.

Exclusive  lock is used to update modify or delete the datas of the table. If a table is exclusive locked then other users cannot update that table but can view it using No-LOCK

Shared lock is the default lock used in progress. If no locks are specified then it will be specified as shared lock. While updating it will be upgrading to exclusive lock else it will be in shared lock status.

Using which locks you can update a table?
Exclusive lock you can update
If you use shared lock it will upgrade to exclusive lock automatically if update is given.

What will be the lock when we read the record and update the record?

Exclusive lock  during updation
No-lock during reading

What is the default lock? What it will be when updated and during other times?

Shared lock is the default lock in Progress.
It will be upgraded to Exclusive lock when data is updated.
It will be set as shared lock during other times.

How to define a shared lock in for each block?

There is no separate definition for shared lock. If we dont specify any locks it will automatically specify it as shared lock.

How you will release a table when using Exclusive locks to use by another table?

We can use a release statement to release table before the end of the block. Otherwise the table will be released only after the end of the block.

What is a dead lock?
A deadlock occurs when two or more users are waiting for data locked by each other. When this happens, these users are stuck (deadly embraced) and cannot continue processing.
Multi-table deadlocks can be avoided by locking the tables in same order in all applications, thus preventing a deadlock condition.

What are the different types of data types available in progress?
Integer  any nos without the decimal  initial value - 0
Character  maximum 256 char , Alphanumeric Initial value  
Decimal  any nos with the exponentials  Initial value  0.00
Date  any common dates  Initial value - ?
Logical  gets two values yes / no or true / false initial value  No.
Recid 
Rowid

What is an Recid ? What is the use of Recid and Rowid?
Stores the identifier for the records stored in the database.
 It allows you to retrieve a pointer to a fetched record. You can use this pointer to:
Position to and retrieve a record from a results list.
Re-fetch record and modify its lock status.
Store as a future record reference.

What is the use of No-undo?
When the value of a variable is changed during a transaction and the transaction is undone, Progress restores the value of the variable to its prior value. If you do not want, or if you do not need, the value of a variable to be undone even when it has been changed during a transaction, use the NO-UNDO option with the DEFINE VARIABLE statement. NO-UNDO variables are efficient; use this option whenever possible.
Specifying NO-UNDO for a variable is useful if you want to indicate an error condition as the value of the variable, perform an UNDO, and later take some action based on that error condition. If one variable is defined LIKE another that is NO-UNDO, the second variable NO-UNDO only if you specify NO-UNDO in the definition of that second variable.

What is the use of undo?

Indicates that the specified block is undone. If you do not specify the UNDO option, then the current transaction is committed when the QUIT statement is executed.





How will you declare the variable that is to be used in more than one programs?
It can be done by defining the variable as the shared variable.
What is the definition of shared variable?
Define new shared variable variable name during the first time the variable is defined in the main program
Define shared variable variable name during the definition of the variable in other sub programs.
What is the scope of the new shared variable?
The scope is untill the execution of the program where it is defined ends.
A shared variable defined in parent program can be used in all its sub programs but the vice versa is not possible.
What is a globally shared variable?
The variable which can be used by the entire mfg pro once you successfully login to the editor is called the globally shared variable. The value for these variables is assigned only once during the login and will remain untill the session ends.
How you define array in progress?
It can be done using the extent statement during the variable declaration.
Is it possible to give different formats to the variables while defining using shared and new shared statements?
No it s not possible to define the variable in two different formats in two programs.
What is an transaction block?
A transaction is a set of changes to the database, which the system either completes or discards, leaving no modification to the database. It will commit the data to the database only at the end of the outer repeat block. Untill then the data can be undone using undo statement.
What are the different types of blocks available in progress?
Procedures
Triggers
Do End
Repeat 
For each.

What is the use of repeat block?
It is used to repeat the execution of the set of statements until the endkey is pressed. 
The iteration can also be stopped by using next statement.
What is the difference between find first and for each statement?
Find first fetches the first record that matches the given condition while for each starts an iteration to display all the records that are available in the table matching the condition given with the for each statement.
What is the different between find first and for first statement?
For first statement displays the first value of the record that matches the condition based on the index key.
While find first it is possible to specify the break by condition and sort the records and it will display the first record based on the sorting.
How will you use more than one for each statement?
Using Comma(,) we can define more than for each statement
 for each table name where condition,
       Each table name where condition:
 End.
Different common include files and its use?
Mftitle.i  - It contains all the globally defined variables in progress.
Mfhead.i  to display the header in the report containing page nos and date.
Mfrtrail.i  to display the footer in the report with the name of user who created the report input variables etc.
Mfrchk.i  to leave the loop when the report is running by using the endkey 
Mfreset.i - when this is defined it will reset all the values stored after the iteration is over
Mfnp.i  to display the datas from the table for the corresponding when you scroll using arrow keys
Pxmsg.i  to display the error message level of error etc.
Whats an preprocessor?
Any statements defined before the proper compilation block is called as the preprocessor statements.

A preprocessor directive is a statement that begins with an ampersand and is meaningful only to the preprocessor.
&GLOBAL DEFINE and &SCOPED DEFINE directives allows you to define preprocessor names, which are compile time constants.

Types of procedures ?
Persistant procedure
Non  Persistant procedure
Define both types of procedures?
Non-Persistant procedures will store the values to the variables only till the procedure is executing. After the procedure execution completes the values are deleted.
While in persistant procedures the values will be retained in the buffers and can be used by any other programs it will be deleted only when the session ends or someone explicitly deletes the values.
What is a CIM? Explain the functionality? What flags you need to set for the same?
CIM  Common Interface Menu.  

This is a functionality provided by Progress to upload data into the tables with proper validations.  This acts the same way the data entered manually with all the validations put in the program.  This is used, as it is faster to upload with all validations.











 














Comments

Popular posts from this blog