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 (September 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 18 Sep 1997 13:54:00 -0500
Reply-To:     txplltw@UABCVSR.CVSR.UAB.EDU
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Todd Weiss <txplltw@UABCVSR.CVSR.UAB.EDU>
Subject:      Re: Need Help from an SCL Guru (fwd)
Comments: To: Robert Anderson <Robert.Anderson@MCI.Com>
In-Reply-To:  <19970918162553.AAA30255@localHost>
Content-Type: TEXT/PLAIN; charset=US-ASCII

To those who are interested, here is the corrected program. ( credit to tech support )

The macro variable had to be reset in MAIN, the CANCEL command had to be captured. Both had to be used to conditionally execute the code based on finding a duplicated id. An SCL var will suffice as a flag too.

***********************************************************

length dupcheck $8; FSEINIT:

control always; x = open ( 'x' ); call symput ( "macdpl", "nodup" ); rc = rc; wrc = wrc; return;

INIT:

dupcheck = symget ( "macdpl" ); cmd = lastcmd (); put dupcheck = cmd =; if dupcheck = "dup" and cmd ~= "CANCEL" then do; alarm; _msg_ = "The id you entered has been duplicated, you are on the original"; protect _all_; call symput ( "macdpl", "nodup" ); end; else do; _msg_ = ""; unprotect _all_; end; return;

MAIN:

if upcase ( word ( 1 ) ) = "UNPROTECT" then do; unprotect _all_; return; end;

if field ( "modified", "id" ) then do; wrc = where ( x, "clear" ); wrc = where ( x, "id="|| putn ( id, "1." ) ); if wrc = 0 then do; put wrc =; if attrn ( x, "any" ) = 1 then do; call symput ( "macdpl", "dup" ); call execcmd ( "cancel; where id = "|| putn ( id, "1." ) ); end; else call symput ( "macdpl", "nodup"); end; end;

return;

TERM: return;

FSETERM: rc = close ( x ); return;


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