Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reformate the infile based on the Condition file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Thu Oct 09, 2008 10:22 am    Post subject: Reformate the infile based on the Condition file
Reply with quote

Hi,

I am have 2 input file. The details are as follows.

Input file 1:
Code:
AAAAAA SSSSS DD    FFFF VVVVV X0002 HHHHH JJJJJJ   10.5  0.0
AAAAAA SSSSS TTT   FFFF VVVVV X0006 HHHHH JJJJJJ   12.0  3.5   
AAAAAA SSSSS DD    FFFF VVVVV X0005 HHHHH JJJJJJ    3.5   .5
AAAAAA SSSSS EER   FFFF VVVVV X0003 HHHHH JJJJJJ     .5  6.3
AAAAAA SSSSS YY    FFFF VVVVV X0008 HHHHH JJJJJJ    0.0 13.7     
AAAAAA SSSSS III   FFFF VVVVV X0009 HHHHH JJJJJJ   12.5   .7

This file is of record length 700 and FB.

INPUT FILE2:
Code:
X0006
X0008
X0009
X0010

This file is of record length 80 and FB. It has only the key field. If these key found in file 1 at position 31:5 we have to add the last 2 fields and change the key field to 'XXXXX' and hard code the values at position 14:5 to 'EEEE '. This should done for the whole file. The out put file format is as follows.

OUTFILE:
Code:
AAAAAA SSSSS DD    FFFF VVVVV X0002 HHHHH JJJJJJ   10.5  0.0
AAAAAA SSSSS DD    FFFF VVVVV X0005 HHHHH JJJJJJ    3.5   .5
AAAAAA SSSSS EER   FFFF VVVVV X0003 HHHHH JJJJJJ     .5  6.3
AAAAAA SSSSS EEEE  FFFF VVVVV XXXXX HHHHH JJJJJJ   24.5 17.9

Output file record length should be 700 and FB.

Can anyone provide me a JCL which solves this?
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Oct 09, 2008 11:17 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed it was ok to have the output records sorted by the key field.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=... input file1 (FB/700)
//IN2 DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/700)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(31,5,CH) KEEPNODUPS -
  WITH(1,701) WITH(708,10) USING(CTL3)
SORT FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC BUILD=(31:1,5,701:C'VV',703:C'XXXXX',
    708:5C'0',713:5C'0')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(701:C'BB',703:31,5,
    708:51,5,UFF,TO=ZD,LENGTH=5,713:56,5,UFF,TO=ZD,LENGTH=5)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,OMIT=(701,2,CH,EQ,C'VV')
/*
//CTL4CNTL DD *
  SORT FIELDS=(703,5,CH,A)
  SUM FIELDS=(708,5,ZD,713,5,ZD)
  OUTREC IFOUTLEN=700,
    IFTHEN=(WHEN=INIT,
       OVERLAY=(51:708,5,ZD,EDIT=(IIT.T),
                56:713,5,ZD,EDIT=(IIT.T))),
    IFTHEN=(WHEN=(701,2,CH,EQ,C'BV'),
       OVERLAY=(14:C'EEEE ',31:703,5))
/*


OUT will have:

Code:

AAAAAA SSSSS EEEE  FFFF VVVVV XXXXX HHHHH JJJJJJ   24.5 17.9     
AAAAAA SSSSS DD    FFFF VVVVV X0002 HHHHH JJJJJJ   10.5  0.0     
AAAAAA SSSSS EER   FFFF VVVVV X0003 HHHHH JJJJJJ    0.5  6.3     
AAAAAA SSSSS DD    FFFF VVVVV X0005 HHHHH JJJJJJ    3.5  0.5     
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Fri Oct 10, 2008 10:28 am    Post subject:
Reply with quote

Hi Frank,

sorry for my mistake. I forgot to mention this. File one has lot of dups. So this code is not working as per my need. Can you please suggest some other way?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Oct 10, 2008 8:41 pm    Post subject:
Reply with quote

Arrrgghhh. Which file has a lot of dups? Show a better example of the records in each input file and what you expect for output.
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Mon Oct 13, 2008 4:39 pm    Post subject:
Reply with quote

Hi Frank,

First Input file: Record length 700, FB, Sum Fields: 50-55 and 57-62 Sum field variable type: Comp-3(PD)

File structure as follows:
Code:
----|----1----|----2----|----3----|----4----|----5----|----6----|----7----700
AAAAAA SSSSS DD    FFFF VVVVV X0002 HHHHH JJJJJJ   10.5    0.0
AAAAAA SSSSS TTT   FFFF VVVVV X0006 HHHHH JJJJJJ   12.0    3.5   
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ    2.0    5.9 
AAAAAA SSSSS DD    FFFF VVVVV X0005 HHHHH JJJJJJ    3.5     .5
AAAAAA SSSSS EER   FFFF VVVVV X0003 HHHHH JJJJJJ     .5    6.3
AAAAAA SSSSS TTT   FFFF VVVVV X0006 HHHHH JJJJJJ    5.0    6.5 
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ    4.0    1.3
AAAAAA SSSSS YY    FFFF VVVVV X0008 HHHHH JJJJJJ    0.0   13.7     
AAAAAA SSSSS III   FFFF VVVVV X0009 HHHHH JJJJJJ   12.5     .7
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ   13.0     .7


Second Inputfile: Record length 80, FB

Code:
----|----1----|----2----|----3----|----4----|----5----|----6----|----7----|----8
X0006
X0008
X0009
X0010


Expected output:

Code:
----|----1----|----2----|----3----|----4----|----5----|----6----|----7----700
AAAAAA SSSSS DD    FFFF VVVVV X0002 HHHHH JJJJJJ   10.5    0.0
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ    2.0    5.9
AAAAAA SSSSS DD    FFFF VVVVV X0005 HHHHH JJJJJJ    3.5     .5
AAAAAA SSSSS EER   FFFF VVVVV X0003 HHHHH JJJJJJ     .5    6.3
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ    4.0    1.3
AAAAAA SSSSS YY    FFFF VVVVV X0011 HHHHH JJJJJJ   13.0     .7
AAAAAA SSSSS EEEE  FFFF VVVVV XXXXX HHHHH JJJJJJ   29.5   24.4


Now i got this output by the code below.

Code:
//*                                                             
//STEP01   EXEC PGM=ICETOOL                                     
//*                                                             
//SYSOUT       DD  SYSOUT=*                                     
//TOOLMSG      DD  SYSOUT=*                                     
//DFSMSG       DD  SYSOUT=*                                     
//*                                                             
//I1       DD  DSN=Infile1 ----700,   
//             DISP=(SHR)                                       
//*                                                             
//I2       DD  DSN=Infile2 ----80,
//             DISP=(SHR)                                       
//*                                                             
//T1       DD  DSN=&&T1,                                       
//             DISP=(MOD,PASS),                                 
//             UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)             
//*                                                             
//T2       DD  DSN=&&T2,                                       
//             DISP=(MOD,PASS),                                 
//             UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)             
//*                                                             
//T3       DD  DSN=&&T3,                                   
//             DISP=(MOD,PASS),                           
//             UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)         
//*                                                       
//O1       DD  DSN=Outfile1 ----700,                             
//             DISP=(NEW,PASS),                           
//             UNIT=SYSDA,SPACE=(TRK,(500,100),RLSE),     
//             DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)         
//*                                                       
//TOOLIN   DD  *    *** CONSTANT CONTROL CARDS ***         
  COPY FROM(I2) TO(T1) USING(CTL1)                         
  COPY FROM(I1) TO(T1) USING(CTL2)                         
  SPLICE FROM(T1) TO(T2) ON(29,5,CH) KEEPNODUPS KEEPBASE -
    WITHALL WITH(1,701)  USING(CTL3)           
  SORT FROM(T2) TO(T3) USING(CTL4)                         
  COPY FROM(T3) TO(O1)                                     
/*                                                         
//*                                                       
//CTL1CNTL DD *                                           
  INREC BUILD=(31:1,5,701:C'VV',703:C'XXXXX')             
/*                                                               
//*                                                             
//CTL2CNTL DD *                                                 
  INREC OVERLAY=(701:C'BB',703:31,5)                             
/*                                                               
//*                                                             
//CTL3CNTL DD *                                                 
  OUTFIL FNAMES=T2,INCLUDE=(701,2,CH,EQ,C'BV')                   
  OUTFIL FNAMES=T3,INCLUDE=(701,2,CH,EQ,C'BB')                   
/*                                                               
//*                                                             
//CTL4CNTL DD *                                                 
  SORT FIELDS=(31,5,CH,A)                                       
  SUM FIELDS=(50,6,57,6,),FORMAT=PD           
  OUTREC IFOUTLEN=700,                                           
    IFTHEN=(WHEN=(701,2,CH,EQ,C'BV'),                           
       OVERLAY=(14:C'EEEE ',29:703,5))
/*


Thank you very much for your help Frank icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us