Search

GlobalSCAPE Knowledge Base

Creating Fixed File Formats for Mainframe File Submissions

Karla Marsh
EFT

THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT v7 and later

DISCUSSION

EFT, together with the Automated Workflow Engine, can be leveraged to ensure that submitted or uploaded files are transformed into a format that is suitable for some mainframe systems.

Mainframes (like the z/OS) support are two main file formats, Variable (V) and Fixed (F) format. They’re often referred to as FB or VB (the B standing for Blocked, which is the most common way of organizing them on physical storage media).

FB files, not surprisingly, have a fixed record length. This means that every record in the file will have exactly the same number of bytes. The file system on the mainframe (the VTOC) stores information on the file, which, among other things, keeps track of this record length. The files can be easily viewed in a text editor on the mainframe like ISPF, as the system knows where to split the file into records based on the fixed record length. There is no delimiter between the records, and no textual or binary data can be stored in the file.

Below is an example AWE script that you can use as is or edit to suit your environment and specific needs.

<AMVARIABLE NAME="targetFilePath" ISPARAMETER="YES">C:\temp</AMVARIABLE>

<AMVARIABLE NAME="targetFileName" ISPARAMETER="YES">target file.txt</AMVARIABLE>

<AMVARIABLE NAME="targetFileWithPath" ISPARAMETER="YES">%targetFilePath%\%targetFileName%</AMVARIABLE>

<AMVARIABLE NAME="outputFile" ISPARAMETER="YES">%targetFilePath%\out_%targetFileName%</AMVARIABLE>

<AMFILEDELETE SOURCE="%outputFile%" AM_ONERROR="CONTINUE" />

<AMVARIABLE NAME="numBytes" ISPARAMETER="YES">94</AMVARIABLE>

<AMVARIABLE NAME="fileSize">0</AMVARIABLE>

<AMGETFILEINFO FILE="%targetFileWithPath%" RESULTVARIABLE="fileSize" FILEPROPERTY="Size" />

<AMVARIABLE NAME="chunks">%Int(fileSize/numBytes)%</AMVARIABLE>

<AMVARIABLE NAME="leftOver">%fileSize MOD numBytes%</AMVARIABLE>

<AMVARIABLE NAME="curData"></AMVARIABLE>

<AMVARIABLE NAME="curIndex"></AMVARIABLE>

<AMVARIABLE NAME="pos">0</AMVARIABLE>

<AMLOOP TOTALLOOPS="%chunks%" RESULTVARIABLE="curIndex">

<AMFILEREAD FILE="%targetFileWithPath%" RESULTVARIABLE="curData" MAXBYTES="%numBytes%" NEWPOSITIONVARIABLE="pos" POSITION="%pos%" />

<AMFILEWRITE FILE="%outputFile%">%curData%</AMFILEWRITE>

</AMLOOP>

<!-- If there are left over bytes, write them. Then pad the rest with spaces up to 94 Bytes (or whatever the numBytes is) -->

<AMIF EXPRESSION="leftOver &gt; 0">

<AMFILEREAD FILE="%targetFile%" RESULTVARIABLE="curData" MAXBYTES="%leftOver%" NEWPOSITIONVARIABLE="pos" POSITION="%pos%" />

<AMFILEWRITE FILE="%outputFile%">%curData%</AMFILEWRITE>

<AMLOOP TOTALLOOPS="%totalBytes-leftOver%" RESULTVARIABLE="curIndex">

<AMFILEWRITE FILE="%outputFile%"> </AMFILEWRITE>

</AMLOOP>

</AMIF>

Details
Last Modified: 8 Years Ago
Last Modified By: kmarsh
Type: HOWTO
Rated 1 star based on 38 votes.
Article has been viewed 33K times.
Options
Also In This Category
Tags