MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert a string to a report file - using lookup file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Thu Feb 06, 2014 3:13 pm    Post subject: Insert a string to a report file - using lookup file Reply with quote

I have two files.
File1 - act as look up table.
File2: Report

Code:

File1:
000000000001 00000 MMM
000000000042 02222 MMM



Code:

File2:                                                     NEW   REPORT                                                         
02/01/11  22:57:48                                  FOR ORGANIZATION: MMM  03/30/13                                                 
____________________________________________________________________________________________________________________________________
STORE  00000    LAC  00-00000-00001       # OF STORES =     1                                                                                         
FAFE    DESC/SIZE  =    PR DASANI DELI                 16.9      FAFE PRICE  =   1/    9.97 -    10.79  FAFE SALES  =           11 
____________________________________________________________________________________________________________________________________
STORE  01111    LAC  00-00000-00016       # OF STORES =     1                                                                       
FAFE    DESC/SIZE  =    TONY CHEESE                              FAFE PRICE  =   1/    .00             FAFE SALES  =            1 
____________________________________________________________________________________________________________________________________
STORE  02222    LAC  00-00000-00042       # OF STORES =     1                                                                                                                                       
FAFE    DESC/SIZE  =    PR BAGLES SUELTOS              1 EA      FAFE PRICE  =   1/    0.48             FAFE SALES  =            2 
____________________________________________________________________________________________________________________________________



The requirement is to edit file2 report and mark the LACs as '***Random weight***', if the LAC along with the store is present in the file1.

For Ex: On File2 - '00-00000-00001' (LAC) for '00000' (Store) which is present in the File1. so this should be marked as ***Random Weight***.

I have to insert ***Random weight*** in cols 123 to 133 in the file2 report.

Output should look like below.

Is there a way to perform this outside cobol....i.e using DFSORT.

Code:

File2:                                                     NEW   REPORT                                                         
02/01/11  22:57:48                                  FOR ORGANIZATION: MMM  03/30/13                                                 
____________________________________________________________________________________________________________________________________
STORE  00000    LAC  00-00000-00001       # OF STORES =     1                                                 *** Random Weight***                                           
FAFE    DESC/SIZE  =    PR DASANI DELI                 16.9      FAFE PRICE  =   1/    9.97 -    10.79  FAFE SALES  =           11 
____________________________________________________________________________________________________________________________________
STORE  01111    LAC  00-00000-00016       # OF STORES =     1                                                                       
FAFE    DESC/SIZE  =    TONY CHEESE                              FAFE PRICE  =   1/    .00             FAFE SALES  =            1 
____________________________________________________________________________________________________________________________________
STORE  02222    LAC  00-00000-00042       # OF STORES =     1                                                   *** Random Weight***                                                                                   
FAFE    DESC/SIZE  =    PR BAGLES SUELTOS              1 EA      FAFE PRICE  =   1/    0.48             FAFE SALES  =            2 
____________________________________________________________________________________________________________________________________



Thanks for your time.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Feb 06, 2014 3:44 pm    Post subject: Reply with quote

Vak255,

It would have been good if you had provided the DCB properties of the files involved. I assumed the following

1. File 1 : DCB =(LRECL=80,RECFM=FB)
2. File 2 : DCB=(LRECL=200,RECFM=FB)
3. Both files have the pre-sorted Match ie.
4. File 1 key start position 1 for length of 12
5. File 2 key start position 22 for a length of 2 and position 25 for a length of 5 and position 31 for a length of 5 for a total key length of 12 bytes
6. The match key in the report file has 'STORE' in the first 5 bytes.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//INA      DD DISP=SHR,DSN=Your input report file FB200               
//INB      DD *                                             
000000000001 00000 MMM                                     
000000000042 02222 MMM                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION COPY                                               
  JOINKEYS F1=INA,FIELDS=(201,12,A),SORTED,NOSEQCK         
  JOINKEYS F2=INB,FIELDS=(001,12,A),SORTED,NOSEQCK         
  JOIN UNPAIRED                                             
  REFORMAT FIELDS=(F1:1,200,?)                             
  INREC IFOUTLEN=200,                                       
  IFTHEN=(WHEN=(1,5,CH,EQ,C'STORE',AND,201,1,CH,EQ,C'B'),   
  OVERLAY=(123:C'*** RANDOM WEIGHT***'))                   
//*                                                         
//JNF1CNTL DD *                                             
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'STORE'),     
  PUSH=(201:22,2,25,5,31,5))                               
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Thu Feb 06, 2014 5:53 pm    Post subject: Reply with quote

Thanks Kolusu. I will check on it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group