Easy-Trieve logic coding help
Select messages from
# through # FAQ
[/[Print]\]
Goto page Previous  1, 2  :| |:
MVSFORUMS.com -> Utilities

#16:  Author: mkelley7 PostPosted: Wed Oct 05, 2005 12:47 am
    —
Thanks, Phantom. That worked great for doing it with sequential files. Trying to do it with a table, however, has stumped a couple of us. When I add those statements I get the following:

Code:
   SORT I701 TO I701 USING (CUSTCODE, STYLE)                 
   SORT ZSTYLES TO ZSTYLES USING (PARM-CUSTCODE, PARM-STYLE) 
*******B054 NOT A VALID FILE - ZSTYLES                       

#17:  Author: PhantomLocation: The Blue Planet PostPosted: Wed Oct 05, 2005 2:00 am
    —
mkelley7,

I think I figured out the cause of the problem. Check this message - Taken from the Eztrieve manual.

Quote:

Table Definition
A table is a collection of uniform data records that presents unique processing
opportunities. All tables have two parts:
Parts Definitions
Argument - Uniquely identifies a table entry.
Description - Remainder of the table entry.


According to this, the Argument must be Unique. In your case, CUSTCODE is not unique by itself. Custcode together with Style makes it unique. But looking at Kolusu's solution, the SEARCH Keyword uses only Custcode to search the table and that is the reason why you are getting the out of sequence error.

I tried with this logic and it worked fine. I am not good in Eazytrieve, May be Kolusu or someone could fine-tune my code.

To make the Argument Unique, I had to swap the positions of New-Style and Custcode, so that, Custcode immediately comes after Old-Style. I used to Sort to do this.

Code:

//R010   EXEC  PGM=SORT                               
//SORTIN   DD  *                                     
B                    AAXXX       91100124             
VP5                  BBXXX       91100197             
AT                   CCXXX       91100235             
DHB                  DDXXX       91100235             
B                    CCXXX       91100235             
B                    EEXXX       91107516             
/*                                                   
//SORTOUT  DD  DSN=&&TEMP1,DISP=(,PASS)               
//SYSOUT   DD  SYSOUT=*                               
//SYSIN    DD  *                                     
  SORT FIELDS=(1,6,CH,A,34,8,CH,A)                   
  OUTREC FIELDS=(1,6,X,34,8,X,22,6)                   
/*                                                   
//*                                                   
//R020   EXEC  PGM=EZTPA00                           
//SYSPRINT DD  SYSOUT=*                               
//SYSOUT   DD  SYSOUT=*                                     
//I701     DD  DSN=YOUR.INPUT.FILE,                 
//             DISP=SHR                                     
//ZSTYLES  DD  DSN=&&TEMP1,DISP=SHR,VOL=REF=*.R010.SORTOUT 
//O701     DD  DSN=YOUR.OUTPUT.FILE,DISP=SHR         
//SYSIN    DD  *                                           
  FILE I701                                                 
   OLD701           1  1360 A                               
   CUSTCODE         1  8  A                                 
   STYLE           44  6  A                                 
   VOIDED         125  1  A                                 
   PLANT          237  4  A                                 
   CUT            545 12  A OCCURS 3                       
   BRANCH         433  5  A                                 
  FILE ZSTYLES TABLE 500                                   
      ARG            1 15  A                               
      DESC          17 06  A                               
                                                           
  FILE O701 FB(0 0)                                         
       NEW701         1 1360  A                           
       O-CHNG-STYLE   44   6  A                           
                                                         
 W-SRCH-ARG                       W  15 A                 
   W-SRCH-OLD-STYLE   W-SRCH-ARG     06 A                 
   FILLER1            W-SRCH-ARG  +6 01 A                 
   W-SRCH-CUST-CODE   W-SRCH-ARG  +7 08 A                 
                                                         
 W-CHNG-STYLE           W  06 A                           
**********************************************************
* MAINLINE                                               
**********************************************************
                                                         
 JOB INPUT I701                                           
                                                         
     W-SRCH-OLD-STYLE  = STYLE                           
     W-SRCH-CUST-CODE  = CUSTCODE                         
     W-CHNG-STYLE      = STYLE                           
     SEARCH ZSTYLES WITH W-SRCH-ARG GIVING W-CHNG-STYLE   
     NEW701            = OLD701                                     
     IF W-SRCH-OLD-STYLE = STYLE AND W-SRCH-CUST-CODE = CUSTCODE   
          O-CHNG-STYLE = W-CHNG-STYLE                               
     END-IF                                                         
     PUT O701                                                       
/*                                                                 


Hope this helps,

Thanks,
Phantom

#18:  Author: mkelley7 PostPosted: Wed Oct 05, 2005 8:53 am
    —
Maybe I am just trying to do the impossible. I was hoping to not pull the jobs instream using sortin. I gave a small sample of the each of the files. The zstyle file would be about 500 records and subject to frequent changes (I don't want to run it through changeman three times a week and the people with access to change the file won't be able to). The file I am changing has about 300,000 records a day and we are looking to change about 20,000 records a day. Is it possible to use a dataset for the zstyle data? Thank you for all of your help, Phantom.

#19:  Author: kolusuLocation: San Jose PostPosted: Wed Oct 05, 2005 9:11 am
    —
Quote:

Maybe I am just trying to do the impossible. I was hoping to not pull the jobs instream using sortin.


Mkelly7,

You got it all wrong. Phantom showed an example using instream data,so that it will be easy to understand here on this forum. But you can replace the instream data with a physical dataset.

Kolusu

#20:  Author: mkelley7 PostPosted: Wed Oct 05, 2005 9:58 am
    —
Phantom, the solution you gave works perfectly. Thanks Kolusu for helping me understand the forums here. Reading the problems and solutions entered here has greatly improved my understanding. I wish I would have found this site years ago.



MVSFORUMS.com -> Utilities


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Goto page Previous  1, 2  :| |:
Page 2 of 2

Powered by phpBB © 2001, 2005 phpBB Group