Writing out multiple records to a subfile from a single recor d

Boyle, Joe Joe.Boyle@cognos.com
Wed, 6 Jun 2001 12:39:38 -0400


Hi George,

load the data using quick would be the easiest way, but you would probably
have to create and write to a permanent dictionary file, although you may be
able to append to a direct subfile, I've never tried to though.


can cle
set default
file * yoursubfile designer
file out-rec designer


proc internal write
begin 

let key-out = sf-key-val

if ERR-COND1 = 'Y'
then begin

let err-out = "Err Cd: 1"
put out-rec reset

end


if ERR-COND2 = 'Y'
then begin

let err-out = "Err Cd: 2"
put out-rec reset

end


if ERR-COND3 = 'Y'
etc...



end


procedure initial
begin
while retrieving yoursubfile
begin

if  ERR-COND1 = 'Y' or  ERR-COND2 = 'Y' etc...
   then do internal write

end
return

end



-----Original Message-----
From: George_DeWolf@midhosp.org [mailto:George_DeWolf@midhosp.org]
Sent: 06 June 2001 17:15
To: powerh-l@lists.swau.edu
Subject: Writing out multiple records to a subfile from a single record


I am looking to generate multiple records from a single record in a subfile.
Here is a simplified version of my program:

ACC {dataset}

DEF ERR-COND1 CHAR*1 = 'Y' IF {condition true}
DEF ERR-COND2 CHAR*1 = 'Y' IF {condition true}
DEF ERR-COND3 CHAR*1 = 'Y' IF {condition true}
DEF ERR-COND4 CHAR*1 = 'Y' IF {condition true}
DEF ERR-COND5 CHAR*1 = 'Y' IF {condition true}

Each one of these fields represent an error condition found when reading a
single record for an account from the {dataset}.  What I would like to
produce is a subfile (don't care if I use Quiz or QTP) which contains the
account number and an error-code.  For example, if I read the record for
account number 1234 from my dataset and find that the error condition flags
1, 3 and 5 are set to "Y", I would like my subfile to contain the following
three records:

Acct #: 1234 Err Cd: 1
Acct #: 1234 Err Cd: 3
Acct #: 1234 Err Cd: 5

I could link from a one-record-per-account subfile (with one field for each
error condition) to an indexed subfile which contains one record for each
potential error condition and only write records when the count from the
subfile equals the error condition number.  For example,

ACC {subfile} & 
  LINK ("X") TO LINK-FLD OF *LINKSUB

DEF ERROR-CODE NUM*3 = KOUNT OF LINKSUB

SEL IF ERR-COND1 = 'Y' AND KOUNT = 1 OR & 
       ERR-COND2 = 'Y' AND KOUNT = 2 OR & 
       ERR-COND3 = 'Y' AND KOUNT = 3 OR & 
       ERR-COND4 = 'Y' AND KOUNT = 4 OR & 
       ERR-COND4 = 'Y' AND KOUNT = 5

REP SUM ACCT-NBR ERROR-CODE

Is there a better way?






= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body to
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.