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

Need to replace a record in a flat file on a condition......


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Mon Jun 16, 2008 10:31 pm
Reply with quote

I need to replace 'AMAP' to some othe value (say XXXX) only for records '10092200' in 17th position. I tried OUTREC with IFTHEN but was not able to run it through. Any help appreciated.

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
********************************* Top of Data *********
INVTADI6PO  103910077127          AMAP          00
INVTADI8    103910092200          AMAP          00
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 16, 2008 11:06 pm
Reply with quote

Hello Alan and welcome to the forums,

Quote:
I tried OUTREC with IFTHEN but was not able to run it through. Any help appreciated.
For someone to help, you need to post the jcl, sort control statements, and any diagnostic info presented by the problem run. You also need to explain if there were unexpected/incorrect results.
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 Jun 17, 2008 12:56 am
Reply with quote

Alan,

I don't know what you tried, but you can use a DFSORT job like the following to do what I think you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
INVTADI6PO  103910077127          AMAP          00
INVTADI8    103910092200          AMAP          00
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
   OPTION COPY
   INREC IFTHEN=(WHEN=(17,8,CH,EQ,C'10092200',
      AND 35,4,CH,EQ,C'AMAP),
     OVERLAY=(35:C'XXXX'))
/*


If that's not what you want, then explain more clearly what it is you do want.
Back to top
View user's profile Send private message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Tue Jun 17, 2008 11:31 am
Reply with quote

Thanks Frank Yaeger and Dick scherrer,

I tried using the above code and it gives me SYNTAX ERROR for IFTHEN, and from the other posts I believe I need release 1.3 in order to use IFTHEN feature.

Now is there a different of changing the record without IFTHEN.

Also there is another small change in requirement, for the below two records, I need AMAP to be changed to XXXX only if 'PO' falls in 9th position and '10092200' falls in 17th position.


Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
********************************* Top of Data *********
INVTADI6PO  103910092200          AMAP          00
INVTADI6      103910092200          AMAP          00


I believe I should run 3 sorts, first to split the files with records to change in one file, change it in that file and again merge it with the other file. But I fear the order of records might be changed.

The JCL I used :

Code:
//ISS064JB JOB (1TOS0160),'0001 TSG SORT',                         
//         REGION=6M,MSGLEVEL=(1,1),                               
//         CLASS=B,MSGCLASS=X,NOTIFY=ISS064                       
//*                                                               
//J010     EXEC  PGM=SORT                                         
//*SORTIN   DD DSN=W.USD.ARP465.ARRCHK2.S03,DISP=SHR               
//SORTIN   DD DSN=TEST.FLATFILE.FOR.SORT,DISP=SHR                 
//*SORTOUT  DD DSN=ISS064.W.USD.ARP465.ARRCHK2.S03.NEW,           
//SORTOUT  DD DSN=TEST.FLATFILE.AFTER.SORTZ,                       
//            DISP=(,CATLG,DELETE),UNIT=WORK,                     
//            SPACE=(CYL,(50,50),RLSE),DCB=*.SORTIN               
//SYSOUT   DD SYSOUT=*                                             
//SYSIN    DD *                                                   
        OPTION COPY                                               
        OUTREC IFTHEN=(WHEN=(17,8,CH,EQ,C'10092200'),             
                   BUILD=(1,34,C'XXXX',39,95))                     
/*


(Here I dint check for the other condition too.

Please let me know if you can provide any ideas here which will be compatible.

Thanks for your help!
Back to top
View user's profile Send private message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Tue Jun 17, 2008 11:47 am
Reply with quote

Typo:


Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+
********************************* Top of Data ********
INVTADI6PO    103910092200          AMAP          00
INVTADI6      103910092200          AMAP          00 
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 17, 2008 7:10 pm
Reply with quote

Hello,

As requested before - post the diagnostic info.

When you mention 1.3, that sounds more like Syncsort. . .
Back to top
View user's profile Send private message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Tue Jun 17, 2008 8:51 pm
Reply with quote

Code:
********************************* TOP OF DATA **************
 SYNCSORT FOR Z/OS  1.1BR   TPF3   U.S. PATENTS: xx,y (C) 2002 SYNC
                                     SERVICE DELIVERY - AAAA   z/OS   1.6.0
 PRODUCT LICENSED FOR CPU SERIAL NUMBER GGG, MODEL 2086 150              LICEN
 SYSIN :                                                                       
   SORT FIELDS=COPY                                                             
   OUTREC FIELDS=(35,4,CHANGE=(4,'AMAP','G81A'),NOMATCH=(35,4))                 
                                 *                                             
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR                                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
******************************** BOTTOM OF DATA *************
[/code]
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 17, 2008 9:32 pm
Reply with quote

Hello,

Instead of:
Code:
CHANGE=(4,'AMAP','G81A'),

try:
Code:
CHANGE=(4,C'AMAP',C'G81A'),


Sorry i can't test this just now, but i believe this will resolve the syntax error. . .
Back to top
View user's profile Send private message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Wed Jun 18, 2008 11:20 am
Reply with quote

Thanks for the help.

Actaully I had got the same for IFTHEN, (Yesterday I had given the other)

Code:
********************************* TOP OF DATA **************
 SYNCSORT FOR Z/OS  1.1BR   TPF3   U.S. PATENTS: xx,y (C) 2002 SYNC
                                     SERVICE DELIVERY - AAAA   z/OS   1.6.0
 PRODUCT LICENSED FOR CPU SERIAL NUMBER GGG, MODEL 2086 150              LICEN
 SYSIN :                                                                       
    OPTION COPY                                 
 OUTREC IFTHEN=(WHEN=(17,8,CH,EQ,C'10092200'),
        *                                     
                BUILD=(1,34,C'AMAP',38,296)) 
                                           
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR                                     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
******************************** BOTTOM OF DATA *************
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jun 18, 2008 7:53 pm
Reply with quote

Hello,

You are confused. . . This is not the same error.

I believe this problem is due to unbalanced parentheses - you have 2 "open"s but 3 "close"s.
Back to top
View user's profile Send private message
Gousiya Mulla

New User


Joined: 02 Jun 2008
Posts: 87
Location: Bangalore

PostPosted: Wed Jun 18, 2008 9:19 pm
Reply with quote

Hi Alan ,

Donno where your getting stucked ..
I have checked for one of you condition (not with PO) and the JCL is the same which you have used , and it gives me the same output what your expecting . C the below code and output .

I am not able to copy the image here .. so attaching .. let me know if it works for you .
icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jun 18, 2008 11:15 pm
Reply with quote

Hello,

Quote:
I am not able to copy the image here
Rather than trying to post the image, it works better if you copy/paste the screen content into your reply and then use the "Code" tag to preserve alignment.

Please refer to some of the earlier replies in this topic to see how that works. Attachments can cause problems because several of the people who provide help here are prohibited from downloading attachments by their site admin policies.

Keep in mind that when you want to post come code/jcl/etc, you can use the "Preview" to see how your reply will appear to the forum (rather than the way it looks in the Reply editor). Once you are satisified with the appearance of your post, then clidk Submit.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Jun 19, 2008 9:00 pm
Reply with quote

alan_blore wrote:
I tried using the above code and it gives me SYNTAX ERROR for IFTHEN, and from the other posts I believe I need release 1.3 in order to use IFTHEN feature.

Just to clarify, IFTHEN, BUILD, and OVERLAY are supported in SyncSort for z/OS 1.2.1.0 and later.
Back to top
View user's profile Send private message
alan_blore

New User


Joined: 01 Aug 2007
Posts: 50
Location: Hosur

PostPosted: Fri Jul 11, 2008 12:37 pm
Reply with quote

Thanks a Lot...
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 -> JCL & VSAM

 


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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top