Posts

Showing posts with the label Progress - 4gl

Progress 4GL interview questions for QAD technology

1.        What is “No-undo” in the variable declaration? 2.        What are the different .pf parameters 3.        What are the different types of  locks in progress? Explain with example. If a record is locked Exclusively, can a shared lock be provided over the same? 4.        What are different type of procedures in progress? Can internal procedure call other internal procedure? If yes how? If no why no? Can external procedure call internal procedures? 5.        How is array defined in progress? What is the limit of extent for progress? Can we create 2 dimensional / multi dimensional arrays in progress / How? If no then how can we achieve the same? 6.        What are browses? 7.        What are queries? 8.        Can we call excel application from progress? How? 9.        What is the difference between can-find and find? 10.     What are the different types of triggers available in progress? Name few database level triggers. 11.     What are the different type

Progress 4GL/Open edge Code to fetch First and Last date of any month.

In the below example we have fetched the First and Last Date of the current month, you can customized it and can use as per your requirement. Define variable date1 as date no-undo. Define variable date2 as date no-undo. run Default_date. Message "First Date of Current Month" date1 " ----" " Last Date of Current Month " date2  view-as alert-box. PROCEDURE Default_date:      Define variable m_session as character no-undo.      Assign        m_session     = SESSION:DATE-FORMAT.    IF INDEX (m_session , "m") = 2 THEN    do:        IF INDEX (m_session , "y") = 3 then        do:             IF Month(Today) <> 12 THEN        Assign     date1 = date("01" + "/" + String(Month(Today)) + "/" + String(YEAR(TODAY)))     date2 = date("01" + "/" + String ( ( Month(Today) + 1 ) ) + "/" + String ( YEAR(TODAY)) ) - 1.             else        Assign

Sample Progress 4GL Query to check duplicate customer in the table

Sample Query to check duplicate customer in the table Define buffer mBuf FOR xx_mstr. Define buffer kBuf FOR xx_mstr. Define temp-table tt    Field tt_recid as recid .  Empty temp-table tt.  Output to "Duplicate_records.xls".  FOR EACH each xx_mstr no-lock :     FIND first tt where tt_recid = recid(xx_mstr) no-lock NO-ERROR.     IF avail tt THEN next.     FIND First mBuf where mBuf.cust-num = xx_mstr.cust-num and recid(mBuf) <> recid(xx_mstr) no-lock no-error.     IF avail mBuf THEN     do:       Export delimiter "~011" mBuf.       FOR EACH kbuf where kbuf.cust-num = xx_mstr.cust-num :            create tt      Assign tt_recid = recid(mBuf).             END.     End.          END.  output close.

use of VST table _lock, to determining if record is lock

/*Below query checks if Purchase order 10765 is locked */ {us/mf/mfdtitle.i} find first po_mstr where po_domain = global_domain and po_nbr = "10765" exclusive-lock NO-WAIT no-error. if avail po_mstr then   Message po_nbr view-as alert-box. If locked po_mstr then do: find first po_mstr where po_domain = global_domain and po_nbr = "10765" no-lock no-error. for first _lock where _Lock._Lock-Recid = Integer (RECID(po_mstr)) no-lock :     find first _file where _File._File-Number = _Lock._Lock-Table no-lock no-error.    message _File._File-Name " is locked by user " _Lock._Lock-Usr _Lock._Lock-Name view-as alert-box.   End. End.

Sample Query to fetch data with date range

/*Sample Query to fetch data with date range*/ Define variable m_date  as Date no-undo. Define variable m_date1 as Date no-undo. Repeat:     Assign       m_date  = ?       m_date1 = ?.       update m_date m_date1 with frame a side-label.             IF m_date  = ? THEN m_date1 = low_date.       IF m_date1 = ? THEN m_date1 = hi_date.            FOR EACH tr_hist where tr_domain = global_domain and tr_effdate >= m_date and tr_effdate <= m_date1 no-lock :            END.       End.

Cim load for 34.4.17.1 Label Master Maintenance

{mfdeclre.i} DEFINE VARIABLE m_file_path         AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "/home/mfg/" . DEFINE VARIABLE m_csv_file          AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "Demo1.csv". DEFINE VARIABLE m_cim_file          AS CHARACTER FORMAT "x(40)" NO-UNDO. DEFINE VARIABLE m_out_file          AS CHARACTER FORMAT "x(40)" NO-UNDO. DEFINE VARIABLE m_cim_errline       AS CHARACTER FORMAT "x(75)". DEFINE VARIABLE m_cim_err           AS CHARACTER NO-UNDO INITIAL NO. DEFINE VARIABLE m_cim_errdesc       AS CHARACTER NO-UNDO FORMAT "x(85)". DEFINE TEMP-TABLE tt_label     FIELD tt_lang    AS  CHARACTER     FIELD tt_term    AS  CHARACTER FORMAT "x(80)"     FIELD tt_long    AS  CHARACTER FORMAT "x(80)"     FIELD tt_short   AS  CHARACTER FORMAT "x(80)"     FIELD tt_small   AS  CHARACTER FORMAT "x(80)"     FIELD tt_stack   AS  CHARACTER FORMAT "

cim load for36.4.17.5 Label Detail Maintenance

{mfdeclre.i} DEFINE VARIABLE m_file_path         AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "/home/mfg/" . DEFINE VARIABLE m_csv_file          AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "Demo2.csv". DEFINE VARIABLE m_cim_file          AS CHARACTER FORMAT "x(40)" NO-UNDO. DEFINE VARIABLE m_out_file          AS CHARACTER FORMAT "x(40)" NO-UNDO. DEFINE VARIABLE m_cim_errline       AS CHARACTER FORMAT "x(75)". DEFINE VARIABLE m_cim_err           AS CHARACTER NO-UNDO INITIAL NO. DEFINE VARIABLE m_cim_errdesc       AS CHARACTER NO-UNDO FORMAT "x(85)". DEFINE TEMP-TABLE tt_label     FIELD tt_field      AS  CHARACTER FORMAT "x(80)"     FIELD tt_program    AS  CHARACTER FORMAT "x(80)"     FIELD tt_term       AS  CHARACTER FORMAT "x(80)"    /* FIELD tt_long       AS  CHARACTER FORMAT "x(80)"     FIELD tt_short      AS  CHARACTER FORMAT "x(80)"     F

QAD - Check the type of location - Progress 4gl

Take locations from Excel, fetch its type and generate new Excel with type DEFINE VARIABLE m_flepath AS CHARACTER FORMAT "x(40)" NO-UNDO . DEFINE VARIABLE m_fleout AS CHARACTER FORMAT "x(40)" NO-UNDO . DEFINE TEMP-TABLE tt_temp     FIELD tt_loc AS CHARACTER . FORM     m_flepath LABEL "File path " WITH FRAME a. REPEAT:     m_fleout = "" .     EMPTY TEMP-TABLE tt_temp .     UPDATE m_flepath WITH FRAME a .     m_fleout = SUBSTRING ( m_flepath , 1 , R-INDEX ( m_flepath , ".") - 1   ).     m_fleout = m_fleout + "log" + ".xls" .     INPUT  FROM value(m_flepath) .     REPEAT:         CREATE tt_temp.         IMPORT DELIMITER "," tt_temp.     END.     INPUT CLOSE.     FOR EACH tt_temp WHERE trim(tt_loc) = "" NO-LOCK  :         DELETE tt_temp .     END.  /* for each */     DO ON ERROR UNDO, RETRY :         OUTPUT TO value(m_fleout).         FOR EACH tt_temp NO-LOCK :          

Report showing junk characters for Chinese characters - Progress 4GL

Some time when we generate a report and it included some Chinese characters then system shows junk character in place of proper Chinese characters to overcome this issue while generating the output you should use code page which can understand Chinese character exp output stream ss to "hello.txt" CONVERT SOURCE  TARGET "UTF-8".    

How to find the Table name if field name is known (Progress4GL)

Below query will be used to find the Table name if field name is known. We have taken the example of field idh_part. /**************************************************/ find first _field no-lock where _Field-name = "idh_part" . if avail _field then do:    find first _file no-lock where RECID(_File) = _Field._File-Recid .       if avail _file then             DISPLAY _File-name _Field-name.     end. /*************************************************/

Take input from two excel and formulate one

This program takes input from two excel sheet and group into one sheet DEFINE VARIABLE cal AS DECIMAL FORMAT "->>>,999,999.999". DEFINE VARIABLE cal1 AS DECIMAL FORMAT "->>>,999,999.999". /*DEFINE VARIABLE site1 LIKE sct_site.*/ DEFINE STREAM tero. DEFINE TEMP-TABLE ttinv NO-UNDO FIELD tt_part AS CHARACTER FIELD tt_qty AS DECIMAL FORMAT "->>>,999,999.999" FIELD tt_val AS DECIMAL FORMAT "->>>,999,999.999". DEFINE TEMP-TABLE ttinv1 NO-UNDO FIELD tttt_part1 AS CHARACTER FIELD tttt_qty1 AS DECIMAL FORMAT "->>>,999,999.999" FIELD tttt_val1 AS DECIMAL FORMAT "->>>,999,999.999". INPUT FROM "C:\Documents and Settings\sachingaur\My Documents\gaur-27\pptrp07.csv". REPEAT: CREATE ttinv. IMPORT DELIMITER "," ttinv. END. INPUT CLOSE. INPUT FROM "C:\Documents and Settings\sachingaur\My

Progess - 4Gl programming

Sample program to export data of table in excel file lets assume we have a table name ferrari having fields tyre , mirror , seats , number. if you want to export the data of this table in excel write the following code output to "Ferrari.xls" . for each ferrari no-lock: put unformatted tyre "~011" mirror "~011" seats "~011" number "~011" skip. end. output close.