Contact Us!
303|905-4110

bpi.readpath()

This subroutine is provided to allow cross-platform (unidata/uniVerse/etc) read path capability. The subroutine allows the developer to target a specific file  by path and it will return the content of that file in the return variable.

Subroutine Syntax

CALL bpi.readpath( path, hdl_dir, doc, ioctl_type, error, message )

Parameters

Param

Direction

Description

path

passed

path to read

hdl_dir

returned

is the handle to directory in path (param)

ioctl_type

passed

is a IOCTL code passed to the read see your multivalue platforms documentation for support for IOCTL.  The default is "RB" which stands for Read Binary

doc

returned

The content of the file

error

returned

success is zero and all other indicates error

message

returned

A descriptive message related to the error (if available on platform)

 Example

This example demonstrates how you could use this subroutine to poll a file until it reaches steady-state at which point your program can proceed.  It could be used when your application wishes to have BP Forms generate a PDF document and then email the document to a recipient using your own email client.  Your app will want to wait until the PDF is fully rendered before calling the email client to attach and send it.  This will ensure that the document is complete when being sent.

steadyState = @false
lastDoc = \\; lastLastDoc = \\;pdfDocument=\\
LOOP
UNTIL (steadyState) DO
CALL bpi.readpath( full_path, hdl_dir, pdfDocument ioctl_type, error, message )
IF NOT(error) THEN
IF pdfDocument NE \\ AND ((lastLastDoc) EQ lastDoc AND ( lastDoc EQ pdfDocument)) THEN
steadyState = @TRUE
END ELSE
lastLastDoc = lastDoc
lastDoc = pdfDocument
nap 50; * half second
END
END ELSE
CRT message
steadyState = @TRUE
END
REPEAT

Thank you to Craig Shaynak for the enhancements to this example!