You are here: Development Standards > Routines > Application-SpecificRoutines > RMPRTXT.PUB

# RMPRTXT.PUB

RMPRTXT.PUB is a public program designed to parse a text file that takes the format of a Microsoft .INI file format. Calling programs can retrieve section headers only, a specific section of the INI file, or the entire file. Up to three separate sections can be retrieved at a given time.

`0060 ENTER TEMP1$,TEMP2$,TEMP3$,FILENAME$,ERRMSG$`

Variable | Description
TEMP1$ | "GET SECTIONS" = Get all section names and return in TEMP1$, separated by line feeds "" = Get all fields in file, not separated by section, and return in template form thru TEMP1$ "xxxxx" = Finds section named xxxxx and returns field names and data in template format
TEMP2$ | "xxxxx" = Finds section named xxxxx and returns field names and data in template format
TEMP3$ | "xxxxx" = Finds section named xxxxx and returns field names and data in template format
FILENAME$ | Text file to open and read data from
ERRMSG$ | Error message returned to calling program

Exit Points | Explanation
EXIT | RMPRTXT.PUB does not return an error.

An .INI file is a standard text file that holds information for a given function. It can be divided into multiple sections, which each section having its own fields. An example of an INI file is as follows:

`[System Paths]`
`Install Directory=d:/`
`Base Directory=../`
`[Prefix Paths]`
`Data 1=../DATA/`
`Data 2=`
`Data 3=`
`Sample=../sample/`
`Graphics=../gui/`
`System=../sysfil/`
`Report Writer=../RWdata/`
`Utilities=C:/OSAS/bbj/utils/std/`
`[Other Paths]`
`CplLstDir=C:/OSAS/76/bbj/bin/`
`RebuildDir=C:/OSAS/76/bbj/utils/mkrecover/`
`Documents=C:/OSAS/76/Document/`
`DocumentShare=C:/OSAS/76/Document/`
`[CD Key]`
`Key=ABCDE-0123456789ABCDEF012`

In this example, the file has 4 different sections, which are noted by the text inside of the '[ ]'. Under each section are field names and data. Each field name can only occur once within a section, and typically, only appears once in the entire file.

Example 1: If TEMP1$ contains "Prefix Paths", TEMP1$ would return the following template: "DATA1:C(9*), DATA2:C(1*), DATA3:C(1*), SAMPLE:C(10*), GRAPHICS:C(7*), SYSTEM:C(10*), REPORTWRITER:C(10*), UTILITIES:C(30*)". Each variable of TEMP1$ can then be access to reflect the data in the file.