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
 

 

Match the field , If found replcace with different character

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

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Tue Apr 27, 2010 7:36 pm    Post subject: Match the field , If found replcace with different character
Reply with quote

Hello All ,

I have two fixed block input files .
FILE 1 = FB 40 byte
FILE 2 = FB 24 byte

output file
FILE3 = FB 24 byte

Here are the rules

1) if File 1 is empty no processing . Simple copy FILE2 to FILE3
2) if File 1 field starting from 7 column(Length 2 BYTE) is equal to FILE 2 FIELD STARTING FROM 23 BYTE(LENGTH 2 BYTE) .Then File 2 (23rd to 25 th byte should be replaced with File 1 (10 to 11 byte) and written to a new ouput file(file3) same attribute as of file 2
3) IF other case record from file 2 should be writtent to (file3)

here is the example
FILE 1
Code:

=COLS> ----+----1----+----2----+----3----+----4
****** ***************************** Top of Dat
000001 111111XXYY                             
000001 111111ZZAA                             
****** **************************** Bottom of D


FILE2

Code:

=COLS> ----+----1----+----2----
****** ************************
000001 00000000            00XX
000002 11111111            99ZZ
000003 22222222            88M3


output should be (file3)

Code:

=COLS> ----+----1----+----2----
****** *************************
000001 00000000            00YY
000002 11111111            99AA
000003 22222222            88M3


Regards
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Apr 27, 2010 8:03 pm    Post subject:
Reply with quote

Can file1 or file2 have duplicates for 2byte field shown?
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: Tue Apr 27, 2010 10:30 pm    Post subject:
Reply with quote

shr_amar,

Here's a DFSORT JOINKEYS job that will do what I think you're asking for. You'll need the Nov, 2009 PTF to use JOINKEYS. If you don't have that PTF, ask your System Programmer to install it.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file (FB/40)
//IN2 DD DSN=...  input file (FB/24)
//SORTOUT DD DSN=...  output file (FB/24)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(7,2,A)
  JOINKEYS F2=IN2,FIELDS=(23,2,A)
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,24,F1:9,2,?)
  SORT FIELDS=(1,8,CH,A)
  OUTFIL IFOUTLEN=24,
    IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),
      OVERLAY=(23:25,2))
/*
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Apr 28, 2010 12:58 am    Post subject:
Reply with quote

Hello Sambhaji

It cannot be duplicate .
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Apr 28, 2010 1:01 am    Post subject:
Reply with quote

Hello Frank,

I m not sure whether Nov, 2009 PTF to use JOINKEYS is present in my shop. i will check . But do we have any other way .Secondly the code which you have given me will work if FILE 1 is empty.

Regds
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: Wed Apr 28, 2010 1:10 am    Post subject:
Reply with quote

First, check to see if you have the Nov, 2009 PTF. If not, we can discuss the possibility of another way (I'd have to spend time thinking about it and I'd rather not if you can use JOINKEYS).

The DFSORT job will copy all of the records in input file2 to the output file if input file1 is empty.
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Wed Apr 28, 2010 2:06 pm    Post subject:
Reply with quote

Hello Frank ,

I am getting the below error :-

Code:


ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 09:34
          JOINKEYS F1=IN1,FIELDS=(7,2,A)                               
                   £                                                   
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
          JOINKEYS F2=IN2,FIELDS=(23,2,A)                             
                   £                                                   
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
          JOIN UNPAIRED,F2                                             
               £                                                       
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
          REFORMAT FIELDS=(F2:1,24,F1:9,2,?)                           
                   £                                                   
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
          SORT FIELDS=(1,8,CH,A)                                       
               £                                                       
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
          OUTFIL IFOUTLEN=24,                                         
                 £                                                     
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY 
             IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),                           
             IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),                         
             £                                                       
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
               OVERLAY=(23:25,2))                                   
               £                                                     
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT                         
ICE751I 0 C5-K48846 C6-K90014 E7-K48846                             
ICE052I 3 END OF DFSORT   
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed Apr 28, 2010 8:10 pm    Post subject:
Reply with quote

shr_amar,

If you were to take a wild guess what this message means, what would your guess be and how would you correct it?

Quote:

ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
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: Wed Apr 28, 2010 10:41 pm    Post subject:
Reply with quote

shr_amar,

If you go back to the job I posted, you'll see that I have blanks at the start of each line in //SYSIN. You don't. That's what the message
BLANK NEEDED IN COLUMN 1 is telling you.

However, C6-K90014 tells me that you don't have the Nov, 2009 PTF so you can't use JOINKEYS. Ask your System Programmer to install that PTF (it's free). For more information on the PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Thu Apr 29, 2010 4:05 pm    Post subject:
Reply with quote

Many Thanks FRANK ,

See i have used the same way you have sugessted . Seems that this is due to PTF .

As it will time to take approval to install PTF . As this is urgent can we have some other way to acheive this ?

Code:

000010 //SYSIN   DD *                                         
000012   JOINKEYS FILES=F1,FIELDS=(7,2,A)     
000013   JOINKEYS FILES=F2,FIELDS=(23,2,A)     
000014   JOIN UNPAIRED,F2                     
000015   REFORMAT FIELDS=(F2:1,24,F1:9,2,?)   
000016   SORT FIELDS=(1,8,CH,A)               
000017   OUTFIL IFOUTLEN=24,                   
000018     IFTHEN=(WHEN=(27,1,CH,EQ,C'B'),     
000019       OVERLAY=(23:25,2))               
000020 /*                                         
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 29, 2010 11:43 pm    Post subject: Reply to: Match the field , If found replcace with different
Reply with quote

shr_amar,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN40     DD DSN=Your 40 byte unq file,DISP=SHR
//IN24     DD DSN=Your 24 byte unq file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)       
//T2       DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  COPY FROM(IN40) USING(CTL1)                                       
  COPY FROM(IN24) USING(CTL2)                                       
  SORT FROM(T1)   USING(CTL3)                                       
  SORT FROM(T2)   USING(CTL4)                                       
//*                                                                 
//CTL1CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(21:9,2,7,2,C'1')                           
//*                                                                 
//CTL2CNTL DD *                                                     
  OUTFIL FNAMES=T1,OVERLAY=(25:C'2')                                 
//*                                                                 
//CTL3CNTL DD *                                                     
  SORT FIELDS=(23,2,CH,A),EQUALS                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(27:SEQNUM,1,ZD,RESTART=(23,2))),
  IFTHEN=(WHEN=GROUP,BEGIN=(27,1,ZD,EQ,1),PUSH=(26:25,1,28:21,2))   
  OUTFIL FNAMES=T2,IFOUTLEN=24,INCLUDE=(25,2,ZD,GE,21),                     
  IFTHEN=(WHEN=(25,2,ZD,EQ,21),OVERLAY=(23:28,2))                   
//*                                                                 
//CTL4CNTL DD *                                                     
  SORT FIELDS=(1,8,CH,A),EQUALS                                     
  OUTFIL FNAMES=OUT                                                 
//*
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Sat May 08, 2010 6:01 pm    Post subject:
Reply with quote

Thanks Kolusu .. This is working
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
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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