200 pts.
 Substring and then concatenate to build key in logical file
hi...i have a 20 position alpha cust# field. we have a truncation issue with scanners, so sometimes the number comes in with the 1st number truncated. we get no hit, and treat it as a new customer. i want to build a logical file, and i think i need to create 3 new fields: the first field would be sst(2 19) of the customer #, the second would be sst(20 1) of the cust# (usually a blank), the third concat(firstfield secondfield) so i get a 20 position field to use as the key. When i use (USE I) (input) on the SST, it compiles, but once i add the concat, it bombs with Field not found - A CDCUS2 CONCAT(CDCUSM1 CDCUSL1)
CPD7926-* .
CPD7926-* . when i have (USE blank) on the sst, it bombs with CPD7552- on the SST lines.
ASKED: May 13, 2005  5:01 PM GMT
UPDATED: May 17, 2005  10:05:37 AM GMT
0 pts.

Answer Wiki:
I've looked in the IBM doc, and it's noted that you can CONCAT zones from physical files only, not defined zones.
Last Wiki Answer Submitted:  May 16, 2005  4:07 AM (GMT)  by  Franck74   0 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




 

If I understand your question, you need a partial field to represent the scanned in data and that data would be sufficient to uniquely identify the record desired.

I believe one of the following should workd. If you can modify the scanning pgm, then you could build a logical like this:
R RECFMT PFILE(PFNAME)
PFLD19 I SST(KEY 2 19)
KEY
NXTFLD
ETC
K PFLD19
(define whatever fields or all fields - depending on how you want to change the code)
Since the original KEY will still be in the record, you don’t have to concatenate anything - and the new key represents the scanned in data.

If you have to have the record length/layout exactly the same for some reason, then another possible approach is to create a logical that substrings the key field into two fields, doing the concatenation in the pgm itself.

PFLD1 I SST(KEY 1 1)
PFLD2 I SST(KEY 2 19)
NXTFLD
ETC
K PFLD2

 0 pts.