LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 19 Mar 2004 12:07:01 -0500
Reply-To:   DAVID NEYLON <DNEYLON@SALLIEMAE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   DAVID NEYLON <DNEYLON@SALLIEMAE.COM>
Subject:   Problems with code
Content-Type:   text/plain; charset=US-ASCII

I'm sorry if this is a bit long, but I want to try to be complete.

I'm writing a SAS program to extract data from a file under Z/OS 1.4 (mainframe). For some reason I'm getting some odd results.

The raw data input is the print output from a previous step. The data is variable length from 9 to 125 characters long. The data seem to be read ok as follows:

data delitems (keep=deldata) gdgdata (keep=deldata); INFILE catlist length=linelength; INPUT linedata 1-1 @ ; datalength = linelength - 1; input @2 catdata $varying125. datalength; put @1 catdata;

As you can see I use a put to the log to let me see the data I'm reading. I then extract a data item based on a character in the data string:

b = index(catdata,'-'); b = b-1; if b > 3 then do; rectype = substr(catdata,1,b); end; else delete; put @1 'this is the rectype after substr extract: '@; put rectype@; put '******';

I check the length of b as I don't want to bother with any record that is too small. The put here is to see the data that was extracted.

I follow that with an if then statement to double check my later select-when conditions.

if rectype =: 'VOLSER' then put 'The if statement found VOLSER'; if rectype = 'CLUSTER' then put 'The if statement found CLUSTER';

Then I go into my select. I'm only going to put a portion of it here of course. I'm looking for more than two rec types, but these do are enough to show my problem.

select (rectype); when ('CLUSTER') do; put @1 rectype 'when logic ****'; dsname = substr(catdata,17,44); deldata = ' DEL '||trim(dsname)||' CLUSTER'; output delitems; end; when ('VOLSER') do; put @1 'rectype is VOLSER'; put @1 catdata; put @1 'extracting volser and unit'; volser = substr(catdata,19,6); unit = substr(catdata,45,8); put @1 volser @10 unit @30 'volser and unit'; end; otherwise do; put @1 'This is the rectype after otherwise fall thru ' rectype; delete; end; end;

Neither the if nor the when for 'VOLSER' are executing as true. Following is an extract of the log;

VOLSER------------DV3025 DEVTYPE------X'3010200F' THIS IS THE RECTYPE AFTER SUBSTR EXTRACT: VOLSER ****** THIS IS THE RECTYPE AFTER OTHERWISE FALL THRU VOLSER CLUSTER ------- UHDWN0.EXTRACT.MEDIUM THIS IS THE RECTYPE AFTER SUBSTR EXTRACT: CLUSTER ****** THE IF STATEMENT FOUND CLUSTER CLUSTER WHEN LOGIC ****

Can anyone think of something I'm doing wrong? Or something I could add that might help my problem.

Thank you,

David Neylon Information Security RACF Technical Support x0269


Back to: Top of message | Previous page | Main SAS-L page