IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Do a lookup operation within a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Tue Apr 08, 2008 1:57 pm
Reply with quote

I am trying to do a lookup operation within a file,

file1 is my input file with 1-9 chars as key and this same key may present in cols 51 thru 59. Now I need to change the rows which has the matching key with sum text and non-matching with some specified text.

If I hard code the values, its working fine... but if give the position of the key its not working... It says "ICE111A E REFORMATTING FIELD ERROR
".

//*===========================================================
//* LOOKUP
//*===========================================================
//S1 EXEC PGM=ICETOOL
//*
//SYSOUT DD SYSOUT=*
//I1 DD DSN=FILE1,DISP=SHR
//O1 DD DSN=FILE2,DISP=(OLD,CATLG,DELETE),
// SPACE=(CYL,(10,8),RLSE),RECFM=FB
//TOOLMSG DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD DSN=SAM.SYMBOLS,DISP=SHR
//TOOLIN DD *
COPY FROM(I1) TO(O1) USING(CT01)
/*

//CT01CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=O1,
OUTREC=(1,9,CHANGE=(9,A,B),
NOMATCH=(C'NOT FND'),1,650)
/*


Content of symbol file:

* FIELDS
A,1,9,CH
B,51,9,CH

Pls suggest...

Thanks in advance.

-Sam.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Apr 08, 2008 10:03 pm
Reply with quote

Well, you can't be using A for the symbol name because that's a reserved word and you'd get an error message for it. So assuming you're using something valid (like a), your CHANGE operand would be translated to:

1,9,CHANGE=(9,1,9,51,9)

This is NOT valid syntax for CHANGE. The format is (v,find,set) where v is the length (9 in your case), find is a constant and set is a field or constant. You have a field for find instead of a constant.

Quote:
If I hard code the values, its working fine


Not if you hardcoded (9,1,9,51,9). You'd get the same ICE111A.

If you're trying to change 1-9 to 'NOT FND' if it doesn't match 51-59, then you would do that with IFTHEN/OVERLAY as follows:

Code:

//S1    EXEC  PGM=ICETOOL
//SYSOUT DD  SYSOUT=*
//I1     DD DSN=...  input file
//O1     DD DSN=...  output file
//TOOLMSG      DD  SYSOUT=*
//DFSMSG       DD  SYSOUT=*
//TOOLIN       DD  *
COPY FROM(I1) TO(O1) USING(CT01)
/*
//CT01CNTL DD *
 OUTFIL FNAMES=O1,
   IFTHEN=(WHEN=(1,9,CH,NE,51,9,CH),OVERLAY=(1:C'NOT FND  '))
/*


You can, of course, use symbols if you like.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top