DATA Step, Macro, Functions and more

How do I display column headings in an unknown dbase?

Not applicable
Posts: 1

How do I display column headings in an unknown dbase?

I am accessing an old mainframe database that has an unknown number of fields. Additionally, I have only a vague idea of the data some fields contain (and for some fields, I have no clue as to what's supposed to be in them).

Is there a way to print out all field headings and count the number of fields? I am thinking some kind of IF/THEN or DO/WHILE loop should do it, but I cannot find an argument to use for generic last column. It would also be nice, if I could tell how many characters are allocated to each field (how many columns per field).

Basically, I am trying to discover as much of the table structure as possible, but I am so new to SAS that I am not quite sure which generic arguments and procedures exist in the language, so any and all help will be heartily appreciated.

SAS at my disposal is a mainframe IBM version circa 1980 (with some newfangled 1997 updates) accessed via a dumb terminal, so please don't go crazy suggesting Windows SAS solutions. Smiley Happy
Posts: 9,374

Re: How do I display column headings in an unknown dbase?

There is a difference between "accessing an old mainframe database" and "accessing an old mainframe sequential file". For example, if you have an old mainframe IMS or DB2 or IDMS or Adabas or FOCUS database, then in order to read the data base directly with SAS, you would need the appropriate SAS/Access product for that specific database. If you have an old ISAM, BSAM or VSAM file, you may be able to read it with SAS. If you have sequential tape files, you may be able to read them with SAS.

You'll have to be a lot more specific about exactly what type of "old mainframe" file/database you're dealing with. Your description doesn't sound like a database (a collection of related tables) but more sounds like a single file or set of single files.

Is there no one at your company who remembers what this file or set of files was used for? No documentation? No data dictionary? No record layout stuck in an old dusty binder someplace?

At the very least, using IBM tools to look at the VTOC information in the catalog (assuming it's a cataloged dataset) should tell you things like the DCB characteristics: DSORG, RECFM, LRECL, BLKSIZE, etc. Using IBM JCL, you can also dump out the contents of a file in hex or in readable form (I don't remember the exact syntax for doing this -- but a good JCL book might help you there.) That's where I would start -- find out basic operating system information before I threw SAS at the problem.

This paper has some useful information on finding files on the mainframe: (Section 3, starts on page 7)

In addition, saying that you have SAS available isn't much help. What version of SAS do you have available: 6.09, 8.2, 9.1??? And, when you access SAS via a dumb terminal -- do you go into TSO, Wylbur, Roscoe?? Do you have ISPF available? How do you submit jobs? With JCL?

Your best bet for help may be to open a track with SAS Tech Support. There are really too many unknowns for someone to give you useful suggestions (in my opinion).

Super Contributor
Super Contributor
Posts: 3,176

Re: How do I display column headings in an unknown dbase?

Hey yv204, there is nothing "old" about the mainframe - you may not want to judge the state of affairs by your surroundings or someone's opinion.

And just because a "mature" DBMS has been around since before some SAS Forum subscribers does not necessarily relegate it to pre-historic status. Possibly you might be uncomfortable with the data-access techniques available to you with processing the data?

I guarantee you there are subscribers willing to help you get results, especially Cynthia, as you may have already observed.

Good luck in your quest.

Scott Barry
SBBWorks, Inc.
Respected Advisor
Posts: 3,852

Re: How do I display column headings in an unknown dbase?

I was thinking perhaps yvNNN has a SAS data library and needs to see the CONTENTS of that library.

yvNNN use the term data base which usually implies something besides a SAS data library, if that is the case there are other tools to discover contents of such data bases.

Flat files would require "extermal" documentation to understand the record layout.

In any case more information is needed to fully understand the problem.
Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation