Using Peoplesoft File Layout
Using Peoplesoft File Layout
Judi Doolittle, OCP, Oracle ACE Natasha Garcia Sandia National L b S di N i l Laboratories i
PeopleCode Example
Local string &string; Local File &Myfile, &Myfile2; &MyFile = GetFile( test.txt , R); GetFile(test txt R ); &MyFile2 = GetFile(c:\temp\test2.txt, W, %FilePath_Absolute); If &M Fil I O &MyFile.IsOpen Then Th While &Myfile.ReadLine(&string); &MyFile2.WriteLine(&string); End-While; E d Whil End-If; &MyFile.Close(); &M Fil Cl () &MyFile2.Close();
N
PeopleCode Example
Local X lD &i L l XmlDoc &inxmldoc ld /* load message to file */ &xmlfile = GetFile("IB MSG TEMP xml" "W"); GetFile("IB_MSG_TEMP.xml", If &xmlfile.IsOpen Then &xmlstring = &inxmldoc GenFormattedXmlString(); &inxmldoc.GenFormattedXmlString(); &xmlfile.WriteString(&xmlstring); &xmlfile.Close(); End-If;
CreateRowset
Local Rowset &rs_carry_desig; &rs_carry_desig = CreateRowset(Record.AV_DESIGNATION);
CreateSQL Function
I t ti t a SQL object from the SQL classthen it Instantiates bj t f th l th opens it on the sqlstring and/or input values. The sqlstring is the parameter that holds the SQL statement SQL errors will cause PeopleCode to terminate with an error MetaSQL
%SelectAll is a way to select everything in a record Tip: Remember to wrap DateTime fields with %DateOut, %TimeOut, %DateIn, and %TimeIn
PeopleCode Example
Local R L l Record & 1 d &rec1; Local SQL &SQL; /*Create Instance of Record */ &rec1 = CreateRecord(record tc help me tbl); CreateRecord(record.tc_help_me_tbl); / Create /*Create SQL object to populate rowset */ / &SQL = CreateSQL(%selectall(:1), &rec1);
File Record ID
Identifies the record Can be used with fixed and CSV files ID must be included in your flat file Assigned at the file layout segment level
End-If; /* Filename */ &filename = &curdate | "_CB_PAR_" | &clientid | ".txt"; /** Create an instance of the File - this will be opened in Write mode with an absolute path. Then associate it with the appropriate File Layout */ &COBRAFile GetFile(&path &filename, "W" %Fil P th Ab l t ) &COBRAFil = G tFil (& th | &fil "W", %FilePath_Absolute); /*********** Filelayout ************************************/ &COBRAFile.SetFileLayout(FileLayout.SL_COB_PAR);
SQL Statements
/* Create SQL object to retrieve values */ &SQL1 = CreateSQL("%selectall(:1)", &recl); &SQL2 = CreateSQL("%selectall(:1)", &rec2); &SQL3 = CreateSQL("%selectall(:1)", &rec3);
Segments
Uses:
Specify the action to take for rows of data Li it fields on th fil l Limit fi ld the file layout t Identify File Layout
Indicate Action
You need to send a flat file to another app
Indicate Action
Insert Update Delete
Limit Fields
Following provided from: PeopleSoft Integration Tools and Utilities, File Layout and Data Interchange section You have a file and you only want two fields from it One way is to update everything and then manually delete the unwanted data Or insert a segment name it the same as the table and insert only the two fields you want
What we covered
Writing Data to a Flat File Methods to Read and Write (Plain Text Files) Writing Files (Defined by a File Layout) Creating an App Engine (to Export Data to Flat File) Creating Multilevel File Layout PeopleCode for Multilevel File Layout Segments in File Layout
Book Signing
Time: 11:45 am to 12:45 pm Location: Bookstore
Download Presentation
http://www.oraclepressbooks.com/downloads/
Questions
jhotsin@sandia.gov Judi_doolittle@ioug.org nygarci@sandia.gov