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

How to do change in COMP field in file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chanchal Majumder

New User


Joined: 09 Jul 2012
Posts: 10
Location: INDIA

PostPosted: Fri Feb 15, 2013 12:23 am
Reply with quote

Hi,
I have to do a mass change in a S9(8) comp 3 field in a file ..
Please suggest how can i do this update in the file using icetool or sort or fileaid ..
Basically i have a table extract and i have to change the date field(S9(8) comp 3) in the file and have to update the same file to mainframe .

Thanks In Advance ....
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 15, 2013 12:37 am
Reply with quote

If You want good answers learn to ask good questions ...

what You told is so generic that trying to guess would be on our side just a waste of time

tell us what SORT product You are using

record format ( FIXED/VARIABLE)
POSITION/LENGTH/FORMAT of the field You need to change

do You need to carry on some logic or brutally overlay a <new> value

did You search the forum before asking?
there are gazillion of examples doing what You ask for
Back to top
View user's profile Send private message
Chanchal Majumder

New User


Joined: 09 Jul 2012
Posts: 10
Location: INDIA

PostPosted: Fri Feb 15, 2013 12:51 am
Reply with quote

Hi,
I can use ICETOOL or SORT or Fileaid
I Have a file with VB .LRECL=786 .What i need is to change the value
from 69 to 73 (5 bytes S9(8) ) comp3 field.
I need to over lay a new value for all the occurrence in the file

As example :
The current value is 20120101(stored in as COMP 3) position 69-73
New value should be 20070101(should store in same comp 3 format ) as i have to load this file to a table in same format .


Thanks in Advance...
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Feb 15, 2013 1:38 am
Reply with quote

Hi Chanchal,

Is this a one time thing ?
Since you mentioned FileAid am guessing its a one time work - you could just do a
Code:
CHANGE ALL X'20120101' X'20070101' 69
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Fri Feb 15, 2013 1:59 am
Reply with quote

First, be careful with you COMP versus COMP-3 terminology. Very different formats.

I did not test this code out but in Easytrieve it would look something like this...
Code:
//SYSIN  DD *
FILE FILEA
*          FIELD FIELD   > A-ALPHANUMERIC  N-NUMERIC  P-PACKED
*          START LENGTH  |
*--- INPUT ---
I-REC          1    786  A
I-COMP-3      69      5  P 0  HEADING ('INPUT COMP-3 FIELD')
*
*--- OUTPUT ---
FILE FILEB
O-REC          1    786  A
O-COMP-3      69      5  P 0  HEADING ('OUTPUT COMP-3 FIELD')
*
*****************---->  WORKING STORAGE FIELDS  <-----*****************
W-COUNT       S       5  P 0.  *COUNT FOR NUMBER OF RECORDS TO PRINT
***********************************************************************
JOB INPUT FILEA    NAME OUTPUT
*
 IF  (I-COMP-3 =  20120101)
     O-REC     = I-REC
     O-COMP-3  =  20070101
     PUT FILEB
ELSE
     O-REC     = I-REC
     PUT FILEB
 END-IF
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 2:22 am
Reply with quote

Binop B wrote:
Hi Chanchal,

Is this a one time thing ?
Since you mentioned FileAid am guessing its a one time work - you could just do a
Code:
CHANGE ALL X'20120101' X'20070101' 69

Mmm...shouldn't that be X'020120101C' and X'020070101C', respectively? These are packed decimal numbers, not binary coded decimal, yes?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Feb 15, 2013 2:45 am
Reply with quote

Akatsukami wrote:
Mmm...shouldn't that be X'020120101C' and X'020070101C', respectively? These are packed decimal numbers, not binary coded decimal, yes?
Agreed ... My bad ... icon_redface.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 15, 2013 4:35 am
Reply with quote

Code:

FILE FILEA
*          FIELD FIELD   > A-ALPHANUMERIC  N-NUMERIC  P-PACKED
*          START LENGTH  |
*--- INPUT ---
I-COMP-3      69      5  P 0  HEADING ('INPUT COMP-3 FIELD')
*
*--- OUTPUT ---
FILE FILEB
O-COMP-3      69      5  P 0  HEADING ('OUTPUT COMP-3 FIELD')
*
*****************---->  WORKING STORAGE FIELDS  <-----*****************
W-COUNT       S       5  P 0.  *COUNT FOR NUMBER OF RECORDS TO PRINT
***********************************************************************
JOB INPUT FILEA    NAME OUTPUT
*
IF  ( I-COMP-3 EQ  20120101 )
    MOVE FILEA TO FILEB
    O-COMP-3  =  20070101
    PRINT AUDIT-REPORT
    PUT FILEB
ELSE
    PUT FILEB FROM FILEA
END-IF


If doing from Sort, you can also print an audit report.
Back to top
View user's profile Send private message
Chanchal Majumder

New User


Joined: 09 Jul 2012
Posts: 10
Location: INDIA

PostPosted: Fri Feb 15, 2013 10:52 am
Reply with quote

Hi.Can any one please give me the sortin statement for Fileaid for the below requirement
CHANGE ALL X'020100715C' X'099991231C' 69

As i have do changes in 10 lacs record ..So i have to do this changes using pgm=fileaid in JCL
Back to top
View user's profile Send private message
Chanchal Majumder

New User


Joined: 09 Jul 2012
Posts: 10
Location: INDIA

PostPosted: Fri Feb 15, 2013 11:10 am
Reply with quote

I am using
'$$DD01 UPDATEALL EDITALL=(X'020100715C' X'099991231C' 74)'

But this is not working icon_sad.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 5:02 pm
Reply with quote

You are relatively new here, Chanchal, so do not take it as an offense when I tell you that to say "It's not working" conveys no information whatsoever.

How is it not working? Does the job abend (not "end with a non-zero completion code"; please learn that there is a difference)? Do you get error messages? Are the results not as desired?

I see that in your latest attempt you have changed what seems to be the start column from 69 to 74; why is that?
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Fri Feb 15, 2013 6:34 pm
Reply with quote

I just realized I added a Easytrieve example solution for a Sort/FileAid question - sorry!

Well, maybe somebody can use it for future use.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 8:18 pm
Reply with quote

Whilst I'm not a *Sort maven and know nothing of Easytrieve save the name, I don't think it is wrong to say, "X is the wrong tool for this task; you should use Y" (otherwise we'd still all be programming in Autocoder icon_biggrin.gif).
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Feb 15, 2013 10:14 pm
Reply with quote

Quote:
Hi.Can any one please give me the sortin statement for Fileaid for the below requirement
CHANGE ALL X'020100715C' X'099991231C' 69

Chanchal, do you not have the ability to read the manual? Why should we read the manual for you when File Aid parameters and options are clearly explained in the Batch Reference Manual?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Feb 15, 2013 10:51 pm
Reply with quote

Chanchal Majumder wrote:
Hi,
I can use ICETOOL or SORT or Fileaid
I Have a file with VB .LRECL=786 .What i need is to change the value
from 69 to 73 (5 bytes S9(8) ) comp3 field.
I need to over lay a new value for all the occurrence in the file

As example :
The current value is 20120101(stored in as COMP 3) position 69-73
New value should be 20070101(should store in same comp 3 format ) as i have to load this file to a table in same format .



Chanchal Majumder wrote:
I am using
'$$DD01 UPDATEALL EDITALL=(X'020100715C' X'099991231C' 74)'

But this is not working icon_sad.gif


Your field starts at 69 and when you add RDW (4 bytes) the position of the field you want to change is at 73.

Anyway here is a DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD DISP=SHR,DSN=Your input VB file
//SORTOUT  DD DSN=Your Output VB file,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(X,Y),RLSE)
//*
//SYSIN    DD *                               
  OPTION COPY                                 
  INREC IFTHEN=(WHEN=(73,5,PD,EQ,20120101),   
  OVERLAY=(73:+20070101,TO=PD,LENGTH=5))       
//*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top