Tuesday, August 2, 2016

PeopleSoft Autoincrement character field

Irrespective of character length below function will return next character

Function auto_incr_char(&Var As string) Returns string
   Local string &substr;
   
   &nc = Len(&Var);
   &var1 = "";
   For &c = &nc To 1 Step - 1
      &substr = Substring(&Var, &c, 1);
      rem check between 65 to 90;
      If Code(&substr) >= 65 And
            Code(&substr) < 90 Then
         &substr = Char(Code(&substr) + 1);
         &var1 = &substr | &var1;
         &var1 = Substring(&Var, 1, &c - 1) | &var1;
         Break;
      Else
         &var1 = "A" | &var1;
      End-If;
   End-For;
   
   Return &var1;
End-Function;

Monday, August 1, 2016

Autoincrement Alphanumeric number using PeopleCode

Below function was created to autoincrement aplhanumeric field, 
3 parameters are needed for executing the function, Previous or max string value, numbers of characters in a field, number of integer values in a field.

Function auto_incr(&Var As string, &Nc As integer, &ni As integer) Returns string
   Local integer &max_int, &i_str;
   Local boolean &maxint;
   Local boolean &max_str;
   Local string &str_i, &str_e, &substr;
   
   &str_i = "";
   For &c = 1 To &ni
      &str_i = &str_i | "9";
   End-For;
   &max_int = Value(&str_i);
   &str_e = Substring(&Var, &Nc + 1, &ni);
   &i_str = Value(&str_e);
   
   If &i_str < &max_int Then
      &i_str = &i_str + 1;
      &var1 = Substring(&Var, 1, &Nc) | &i_str;
   Else
      &maxint = True;
      &str_i = "";
      For &c = 1 To &ni - 1
         &str_i = &str_i | "0";
      End-For;
      &str_i = &str_i | "1";
   End-If;
   
   If &maxint = True Then
      For &c = &Nc To 1 Step - 1
         &substr = Substring(&Var, &c, 1);
         rem check between 65 to 90;
         If Code(&substr) >= 65 And
               Code(&substr) < 90 Then
            &substr = Char(Code(&substr) + 1);
            &var1 = Replace(&Var, &c, 1, &substr);
            &var1 = Replace(&var1, &Nc + 1, &ni, &str_i);
            Break;
         End-If;
      End-For;
   End-If;
   Return &var1;
End-Function;

&str = "AZZ899";
&res = auto_incr(&str, 3, 3);
WinMessage(&res);

Wednesday, March 5, 2014

Create / Drop table in PeopleCode

There are instances where we need to create and drop the table dynamically using PeopleCode / AE.

In sqr we have on-error if there are any issues in creating a table.
In the same way for PeopleCode we can use try..catch block.

Example: 

try
sqlexec("Drop table PS_XXXX");
catch (exception e)
Rem ignore exception;
End-try;

sqlexec("Create table PS_XXX ....");


Monday, January 20, 2014

Crack VBA excel password

Step 1:

To crack the password of an VBA Macro / coding first download an HEX Editor, its available from the site http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm

Step 2:

Close the workbook and open the workbook file in the hex editor.
Find the string "DPB" and change it to "DPx" (x is in small letter).
Save the file.

Step 3:

Open the workbook and click OK until the workbook is open (one or more dialogs are displayed describing various problems with the VBA project).

Press ALT+F11, choose the menu command Tools->VBAProject Properties, navigate to the Protection tab, and change the password but do not remove it (note the new password). Save, close,

Step 4:

Re-open the workbook. Press ALT+F11 and enter the new password.

Choose Tools->VBAProject Properties, navigate to the Protection tab, and remove the password. Save the workbook.

Now open the same workbook, You can use the password that you already given.

Thursday, January 16, 2014

Aggregate multiple rows of data into 1 column and insert into multiple columns

There will be scenario where we want to extract multiple rows data into one column and may insert column data for multiple columns in a single or multiple columns. 
This can be done using listagg and substr functions using oracle.

Below SQL will extract multiple rows of compensation in a single column, each value separated by delimiter comma (,).

 SELECT COUNT(*) c
,comp.emplid
,comp.effdt
,COMP.EMPL_RCD
,COMP.EFFSEQ
, listagg (comp.comp_ratecd||','||comp.comprate, ',') WITHIN
GROUP (
ORDER BY comp.comp_ratecd) comprates
FROM PS_COMPENSATION COMP
, PS_COMP_RATECD_TBL B
WHERE COMP.COMP_RATECD= B.COMP_RATECD
AND B.EFF_STATUS = 'A'
AND B.COMP_BASE_PAY_SW ='N'
AND B.EFFDT=(
SELECT MAX(B1.EFFDT)
FROM PS_COMP_RATECD_TBL B1
WHERE B.COMP_RATECD=B1.COMP_RATECD
AND b1.effdt <=COMP.EFFDT)
GROUP BY comp.emplid,comp.effdt,COMP.EMPL_RCD,COMP.EFFSEQ


And using substr and instr we can split one column data to multiple columns.
Below sql will show how multiple rows of data are extracted into 1 column and insert into multiple columns (10 columns).
SELECT A.EMPLID 
 ,A.EFFDT 
 ,a.EMPL_RCD 
 ,A.EFFSEQ 
 , NVL((CASE WHEN A.C >= '1' THEN substr(a.comprates  ,1 
 ,instr(a.comprates ,','  ,1  ,1)-1) ELSE '' END)  ,' ') COL1 
 , NVL((CASE WHEN A.C=0 THEN '' 
WHEN A.C=1 THEN substr(a.comprates 
 ,instr(a.comprates ,','  ,1  ,1)+1 
 ,LENGTH(a.comprates)-instr(a.comprates  ,','  ,1  ,1)+1)
 WHEN A.C > '1' THEN substr(a.comprates  ,instr(a.comprates  ,','  ,1  ,1)+1  ,instr(a.comprates  ,','  ,1  ,2)-(instr(a.comprates ,','  ,1  ,1)+1)) END)  ,0) COL2 
 , NVL((CASE WHEN A.C<=1 THEN '' 
WHEN A.C >= '2' THEN substr(a.comprates 
 ,instr(a.comprates ,','  ,1  ,2)+1  ,instr(a.comprates  ,','  ,1  ,3)-(instr(a.comprates ,',' ,1 
 ,2)+1)) END)  ,' ') COL3 
 , NVL((CASE WHEN A.C=0 THEN '' 
WHEN A.C=1 THEN '' WHEN A.C ='2' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,3)+1  ,LENGTH(a.comprates)-instr(a.comprates  ,','  ,1 
 ,3)+1) 
WHEN A.C > '2' THEN substr(a.comprates  ,instr(a.comprates  ,','  ,1  ,3)+1 
 ,instr(a.comprates  ,','  ,1  ,4)-(instr(a.comprates  ,','  ,1  ,3)+1)) END)  ,0) COL4 
 , NVL((CASE 
WHEN A.C<=2 THEN '' WHEN A.C >= '3' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,4)+1  ,instr(a.comprates  ,','  ,1  ,5)-(instr(a.comprates  ,','  ,1 
 ,4)+1)) END)  ,' ') COL5 
 , NVL((CASE 
WHEN A.C=0 THEN '' WHEN A.C=1 THEN '' WHEN A.C=2 THEN '' WHEN A.C ='3' THEN substr(a.comprates  ,instr(a.comprates  ,','  ,1  ,5)+1  ,LENGTH(a.comprates)-instr(a.comprates 
 ,','  ,1  ,5)+1) 
WHEN A.C > '3' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,5)+1  ,instr(a.comprates  ,','  ,1  ,6)-(instr(a.comprates  ,','  ,1  ,5)+1)) END)  ,0) COL6 
 , NVL((CASE WHEN A.C<=3 THEN '' 
WHEN A.C >= '4' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,6)+1  ,instr(a.comprates  ,','  ,1  ,7)-(instr(a.comprates  ,','  ,1 
 ,6)+1)) END)  ,' ') COL7 
 , NVL((CASE WHEN A.C=0 THEN '' WHEN A.C=1 THEN '' WHEN A.C=2 THEN '' WHEN A.C=3 THEN '' WHEN A.C ='4' THEN substr(a.comprates 
 ,instr(a.comprates ,','  ,1  ,7)+1  ,LENGTH(a.comprates)-instr(a.comprates  ,','  ,1  ,7)+1) 
WHEN A.C > '4' THEN substr(a.comprates  ,instr(a.comprates  ,','  ,1  ,7)+1  ,instr(a.comprates 
 ,','  ,1  ,8)-(instr(a.comprates  ,','  ,1  ,7)+1)) END)  ,0) COL8 
 , NVL((CASE WHEN A.C<=4 THEN '' WHEN A.C >= '5' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,8)+1  ,instr(a.comprates  ,','  ,1  ,9)-(instr(a.comprates  ,','  ,1  ,8)+1)) END)  ,' ') COL9 
 , NVL((CASE WHEN A.C=0 THEN '' WHEN A.C=1 THEN '' WHEN A.C=2 THEN '' WHEN A.C=3 THEN '' WHEN A.C=4 THEN '' WHEN A.C >= '5' THEN substr(a.comprates 
 ,instr(a.comprates  ,','  ,1  ,9)+1  ,9) END)  ,0) COL10 
  FROM ( 
 SELECT COUNT(*) c 
 ,comp.emplid 
 ,comp.effdt 
 ,COMP.EMPL_RCD 
 ,COMP.EFFSEQ 
 , listagg (comp.comp_ratecd||','||comp.comprate 
 , ',') WITHIN 
  GROUP ( 
  ORDER BY comp.comp_ratecd) comprates 
  FROM PS_COMPENSATION COMP 
  , PS_COMP_RATECD_TBL B 
 WHERE COMP.COMP_RATECD= B.COMP_RATECD 
   AND B.EFF_STATUS = 'A' 
   AND B.COMP_BASE_PAY_SW ='N' 
   AND B.EFFDT=( 
 SELECT MAX(B1.EFFDT) 
  FROM PS_COMP_RATECD_TBL B1 
 WHERE B.COMP_RATECD=B1.COMP_RATECD 
   AND b1.effdt <=COMP.EFFDT) 
  GROUP BY comp.emplid,comp.effdt,COMP.EMPL_RCD,COMP.EFFSEQ) A, PS_xx_stage_tbl STG 
 WHERE a.emplid=STG.EMPLID 
   AND a.EFFDT=STG.EFFDT 
   AND A.empl_rcd = STG.empl_rcd 
   AND A.effseq = STG.effseq  


Monday, August 12, 2013

Generating xls file in PeopleSoft using OLE Automation

Generating xls or formatted excel file is tedious with SQR.
But we can generate them using Peoplecode with OLE Automation.
We need to create a Excel object and then we can use almost all VBA commands in PeopleCode with Peoplesoft notations, Remember vbconstants like vbblue will not be used here.
Also Make sure you are running this code in windows server with excel installed.

Local object &workApp;Local object &workBook;
Local object &workSheet1, &workSheet2, &workSheet3, &workSheet4;
try
 &workApp = CreateObject("COM", "Excel.Application"); 
 ObjectSetProperty(&workApp, "Visible", False);
 &workBook = &workApp.WorkBooks.Add(); 
 &workSheet1 = &workBook.WorkSheets(1); 
 &workSheet2 = &workBook.WorkSheets(2);  
 &workSheet3 = &workBook.WorkSheets(3); 
 &workSheet3.activate();  
 &workSheet4 = &workBook.Worksheets.Add(4);

 Rem - Name worksheets   
 &workSheet1.name = "Hires";  
 &workSheet2.name = "Terminations"; 
 &workSheet3.name = "Contract Changes"; 
 &workSheet4.name = "New";   

 Rem - Assign values in different worksheets  
 &workSheet1.Cells(1, 1).Value = "Sample1";  
 &workSheet1.Cells(1, 2).Value = "Heading2";    
 &workSheet1.rows(1).Font.Bold = True;  
 &workSheet1.rows(1).Font.colorindex = 5;    
 &workSheet1.rows(1).Interior.colorindex = 3;   
 &workSheet1.rows(1).Font.size = 8;

 &workSheet2.Cells(1, 1).Value = "Sample2 for big text";  
 &workSheet2.Cells(1, 2).Value = "Sample2 for big text, even big";  
 &workSheet2.rows(1).Font.size = 10; 
 &workSheet2.rows(1).Font.Name = "Verdana";  
 &workSheet2.Columns.AutoFit(); 
 &workSheet3.Cells(1, 1).Value = "Sample3"; 
 &workSheet4.Cells(1, 1).Value = "Sample4"; 
 SQLExec("select PRCSOUTPUTDIR from psprcsparms where prcsinstance= 
 (select max(prcsinstance) from psprcsrqst where prcsname='AENAME')", 
 &path); 
 &sFileName = &path | "\ExportData2Excel.xls";   
 &workApp.ActiveWorkBook.SaveAs(&sFileName, 18);
 &workApp.Quit();  
 MessageBox(0, "", 0, 0, "Information has been exported to an Excel file """ |  
 &sFileName | """.");  catch Exception &exp  
throw
 CreateException(1000, 22407, "Error saving MS Excel file." | &exp);
end-try;

Wednesday, July 24, 2013

Process Groups in PeopleSoft

The process groups are not stored in any setup table of its own.
They are stored in the table: PRCSDEFNGRP and PRCSJOBGRP where we store the process and job definitions.
If you take a look a look at the prompt for PRCSGRP field in those tables, it is a 'Prompt with no edit', so u can keep adding new Process groups on the fly, on process and job definition components (Page: Process Definition Options)

Significance of the process group:

They are linked with the user ID through a permission list. 
On the permission list setup, in the "Process tab", you can link the process groups.
This plays very important role in securing the processes and jobs in the system. Process groups to users are tied as below

Process Group ->Permission list -> Roles->User profiles

To find which permission lists have access to which process groups use the following query:

select * from PSAUTHPRCS order by CLASSID, PRCSGRP;

Below screens will show how the new process group is created and mapped through user profile.











Monday, May 20, 2013

Union / Minus operator in SQR

There are different scenarios where we will be using Union / Union all / Intersect / Minus operator in sqr.
below is the example of using union in sqr

begin-select 
field-a &fld-a 
field-b &fld-b 
from tbl1 
where ....
union 
select field-c, field-d from tbl2 where....
end-select

Friday, May 17, 2013

Delete PeopleSoft Query


There could be different reasons we would like to delete a query from the database. Below are the SQL that are needed to delete a query from database.

   DELETE FROM PSQRYDEFN WHERE QRYNAME='Queryname';
   DELETE FROM PSQRYSELECT WHERE QRYNAME='Queryname';
   DELETE FROM PSQRYRECORD WHERE QRYNAME='Queryname';
   DELETE FROM PSQRYFIELD WHERE QRYNAME='Queryname';

Wednesday, May 8, 2013

The macro cannot be found or has been disabled while accessing BI publisher in MS Word

Recently I have installed XML publisher in my local client workstation.
When I open Microsoft word and try to access Oracle BI publisher I got below error













From different google sources below are two most common errors and how should Word be setup correctly

















Templates should correctly enabled
























Even after above 2 actions my issue is not solved.

Solution to above issue is

Solution 1:

Search for MSComctlLib.exd in your local drive and rename all the existence, such as MSComctlLib.exd_bak.

usually the file will occur in %USERPROFILE%Application Data\Microsoft\Forms or C:\Users\ramu\AppData\Roaming\Microsoft\Forms

now re-open microsoft word, this will create new file of MSComctlLib.exd  and try accessing BI publisher.
if above soltion doesnot solve your issue. try below

Solution 2:


For 64-bit operating systems, type the following in command prompt (Run command prompt as administrator, otherwise you will get error code 0x80004005): 

Regsvr32 "C:\Windows\SysWOW64\MSCOMCTL.OCX"

For 32-bit operating systems, type the following:

Regsvr32 "C:\Windows\System32\MSCOMCTL.OCX"

open the Microsoft word and access BI Publisher now.

Equivalent of grep in windows


There are instances where we want to search for table / field referenced in sqr on windows.
The built in windows command FindStr mirrors the capabilities of the Unix command Grep.

Findstr /?
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
        [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
        strings [[drive:][path]filename[ ...]]
  /B         Matches pattern if at the beginning of a line.
  /E         Matches pattern if at the end of a line.
  /L         Uses search strings literally.
  /R         Uses search strings as regular expressions.
  /S         Searches for matching files in the current directory and all
             subdirectories.
  /I         Specifies that the search is not to be case-sensitive.
  /X         Prints lines that match exactly.
  /V         Prints only lines that do not contain a match.
  /N         Prints the line number before each line that matches.
  /M         Prints only the filename if a file contains a match.
  /O         Prints character offset before each matching line.
  /P         Skip files with non-printable characters.
  /OFF[LINE] Do not skip files with offline attribute set.
  /A:attr    Specifies color attribute with two hex digits. See “color /?”
  /F:file    Reads file list from the specified file(/ stands for console).
  /C:string  Uses specified string as a literal search string.
  /G:file    Gets search strings from the specified file(/ stands for console).
  /D:dir     Search a semicolon delimited list of directories
  strings    Text to be searched for.
  [drive:][path]filename Specifies a file or files to search.

Example 1:

findstr /n /i /s /c:"ps_job" "d:\sqr\*.*" > "c:\temp\output.txt"

The above example will search for ps_job in all files on folder / sub-folders of d:\sqr\ and redirect the output to output.txt in c:\.
/n - will print the line number ps_job is referenced.
/i - will ignore case-sensitive
/s - will search string in all files on folder and subfolders od d:\sqr\
/c - denotes to search for string.

Example 2:

findstr /n /i /s /g:"d:\search_all.txt" "d:\sqr\*.*" > "c:\temp\output.txt"

we can also search for multiple strings in one command.
save the file having multiple strings in d:\search_all.txt (multiple strings should be ended with newline)
this example will search of all strings defined in d:\search_all.txt on d:\sqr\ and redirect the output to c:\temp\output.txt

Time and Labor installation steps

Below are the basic installation steps required for Time and Labor

Tuesday, May 7, 2013

(SQR 4407) Referenced variables not defined

There are 2 causes of this issue to occur.

1. Code between Begin-Select and End-select are not correctly formatted
or
2. check for variable which got error out, if the variable is referenced inside a procedure which have parameters (Called as function) and also referenced outside the issue occurs, the solution will be pass the referenced variable as parameter to the procedure.

Example for 2:

begin-select
----
----
    let $emplid=&emplid
----
----
end-select
do proc1($setid)


begin-procedure proc1($setid)
begin-select
----
---
where emplid = $emplid and setid=$setid
----
end-select
end-procedure

should be changed as below


begin-select
----
----
    let $emplid=&emplid
----
----
end-select
do proc1($setid,$emplid)


begin-procedure proc1($setid,$emplid)
begin-select
----
---
where emplid = $emplid and setid=$setid
----
end-select
end-procedure

(SQR 9004) TrueType font file cumbwr__.ttf cannot be opened

There are two things to check; either the font file does not exist in the location specified in pssqr.ini file, or the path specified in sqr.ini file is not correct. 

01 = Font type. 
Verify if the setup is correctly into the pssqr.ini to the  [TrueType Fonts] section 
The Font Path=directory where fonts resides and the TrueType collection file (.ttf).

For example:
 [TrueType Fonts]

; This section specifies the mapping from TrueType font names used in 
; above configuration section and physical file path of the font on 
; operating system. For TrueType collection file (.ttc), font directory 
; number should also be specified.
; (ex. font name=file path, directory number)

; Font Path=directory where fonts resides.  Default is SQRDIR.  On 
; Windows, Windows font directory will be looked up too.  Fonts not 
; residing on other directories must be specified full physical path.

Font Path= <PSHOME>\fonts\truetype\
Albany=albw.ttf
Albany-Bold=albwb.ttf
Cumberland=cumbwr__.ttf
Cumberland-Bold=cumbwb__.ttf
Thorndale=thowr___.ttf
Thorndale-Bold=thowb___.ttf
Angsana=angsa.ttf

02 = Font file path.
Verify if the thowr___.ttf collection is located to the correct destination  <PSHOME>\fonts\truetype.

Note: if you are running sqr on unix then check pssqr.unx file

Thursday, March 8, 2012

Access external link in PeopleSoft

We have a situation to access external links in peoplesoft without navigation frames and below are the solution for that.

Navigate to PeopleTools >Portal > Structure and Content.
Choose the folder you would like your link to be in or you can add a new folder just for this new link if you'd like.
Now scroll all the way to the bottom and click "Add Content Reference".

Name: Add what ever name you would like here. Users will not see this link.
Label: This will end up being the link the users will click on.
Long Description: Long desc for your link - this will show just below your actual link.
Usage Type: Target
No Template Check Box: Make sure you CHECK this one so the portal template wont wrap around your page.


URL Information
URL Type: Non-PeopleSoft URL
Portal URL: The website you are trying to open (example:
http://www.blogger.com)

Now in the Content Reference Attributes of the Content Ref Administration page add the following to get your page to open in a new window:
Name: NAVNEWWIN
Label: You can leave this one blank
Attribute value: true
Translate Check Box: Make sure this is UNCHECKED

Save and that's it! Don't forget to clear cache on your browser sign out and sign back in for changes to take effect

You can also try with URL Type as peoplesoft related URL and having peoplesoft component link in Portal URL and change psp in link to psc to view the content

Wednesday, July 11, 2007

Peoplecode collections

The above are the list i collected from different forums

PeopleCode: Comparing a variable to a list of values

I sometimes come across a chunk of PeopleCode that requires a variable be compared to a list of values — like the IN operator in SQL:
If &code = "ABCD" Or &code = "HIJK" Or &code = "OPQR" Then

If the condition needs to be checked multiple times within the code and the list changes, there will be some effort required to update the code.
A better coding approach is to use an array and its Find method:

Local array of string &list;
&list = CreateArray("ABCD", "HIJK", "OPQR");
...
If &list.Find(&code) > 0 Then
If the list of values changes, only the array will need to be updated.

Smarter coding techniques with arrays


you might want to collect a list email addresses this way, separating each item with a semicolon:

While &sqlEmails.Fetch(&email)
If none(&mail_list) Then
&mail_list = &mail_list ";" &email;
Else &mail_list = &amp;email;
End-While;

Or you may want to collect a list of values to use in an IN clause for a subsequent SQL call:

For &i = 1 to &Rowset.RowCount
If &i = 1 Then &dept_list = Quote(&Rowset(&i).EMPLOYEES.DEPTID.Value);
Else
&dept_list = &dept_list "," Quote(&Rowset(&i).EMPLOYEES.DEPTID.Value);
End-If;
End-For;
&dept_list = "(" &dept_list ")";

PeopleCode arrays, with its Join() method makes this task easier. The above statements can be written as:
&Array1 = CreateArrayRept("", 0);
While &sqlEmails.Fetch(&email)
&Array1.Push(&amp;email);
End-While;
&mail_list = &amp;Array1.Join(";","","");
And
&Array1 = CreateArrayRept("", 0);
For &i = 1 to &Rowset.RowCount
&Array1.Push( Quote(&Rowset(&i).EMPLOYEES.DEPTID.Value) );
End-For;
&dept_list = &amp;Array1.Join(",");

The Join() method concatenates all items in an array with a specified separator string. By default, it also encloses the concatenated value by a pair of parenthesis. These can be overridden by specifying a 2nd and 3rd parameter.

Direct access to component

Yet another thing I learned this week. It is possible to open a component directly, bypassing the search page — of course after logging in — from a URL link. In the URL, just add the search key field values in the query string. You’ll have to specify the exact search key fieldname and value pairs: ?EMPLID=AA01234&EFFSEQ=1

This could be useful when sending notifications to users via email, and you want to provide a link directly to the specific page and data.

Reading CSV file using file layout

If FileExists("c:\csv\final\dependent.csv", %FilePath_Absolute) Then
&MYFILE1 = GetFile("c:\csv\final\dependent.csv", "r", "a", %FilePath_Absolute);
End-If;
&MYFILE1.SetFileLayout(FileLayout.DEPENDENT_BENEF);
&RS1 = &MYFILE1.ReadRowset();
While &RS1 <> Null
&EMPLID = &RS1.GetRow(1).DEPENDENT_BENEF.EMPLID.Value;
...........
&RS1 = &MYFILE1.ReadRowset();
End-While;
&MYFILE1.Close();

SQL OBJECT

Local SQL &mysql;
Local record &rec;
&rec= createrecord (record.locations);
&mysql=createsql(“%selectall (:1) where setid=:2 and oprclass = :3”);
&mysql.execute(&rec,&setid, &oprclass);
If &mysql.fetch(&amp;rec) then
…
End-if;
&mysql.close();

To get all fields in record

Local Field &FLD;
Local Record &REC;

If CHECK_FIELD Then
&REC = GetRecord();
For &I = 1 to &amp;REC.FieldCount
&FLD = &REC.GetField(&I);
&LABELID = &FLD.Name;
&FLD.Label = &FLD.GetShortLabel(&LABELID);
End-For;
End-If;
&REC = GetRecord(); /*returns primary record */

The following returns the other record in the current row.

&REC2 = GetRecord(RECORD.CHKLST_ITM_TBL);

The following event uses the @ symbol to convert a record name that’s been passed in as a string to a component name.

Function set_sub_event_info(&REC As Record, &NAME As string)
&FLAGS = CreateRecord(RECORD.DR_LINE_FLG_SBR);
&REC.CopyFieldsTo(&FLAGS);
&INFO = GetRecord(@("RECORD." &amp;NAME));
If All(&INFO) Then
&FLAGS.CopyFieldsTo(&INFO);
End-If;
End-Function;