Friday, April 1, 2016

Creating a Single Obs from Multiple Records In Flat Files

Creating a Single Obs from Multiple Records

Description:  To Create a Single Obs from Multiple Records there are two types of line pointer controls

  • The forward slash (/) specifies a line location that is relative to current one
  • The #n specifies the absolute number of the line to which you want to move the pointer
  1. The Forward Slash (/) Line Pointer Control (Reading Multiple Records Sequentially)
In this Method we can read records only in Sequence in which they are present in flat file
  1. The #n Line Pointer Control (Reading Multiple Records Non-Sequentially)
On the other hand in this Method we can read records in any Sequence as per Desired

In flat file mohit.txt FName and LName are in first record, followed by City and State in second record, Organisation and Id in third record.

NOTE :Raw Data file must contain the same number of records for each Obs .Suppose if we are having only two records for the the Second member then it reads the first record of third member as third record of second member which results in ambiguity in output.


Flat Files


mohit.txt

















EXAMPLE (Code)



OUTPUT

EMPLOYEE (READING MULTIPLE RECORD SEQUENTIALLY)

EMPLOYEE1 (READING MULTIPLE RECORD NON-SEQUENTIALLY)





Got Questions ? Pls put them in Comment Box........