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
 

 

How to do change in COMP field in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to do change in COMP field in file
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 15, 2013 12:37 am    Post subject: Reply to: How to do change in COMP field in file
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    Post subject:
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    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 2:22 am    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Fri Feb 15, 2013 4:35 am    Post subject:
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    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 5:02 pm    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Fri Feb 15, 2013 8:18 pm    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Fri Feb 15, 2013 10:14 pm    Post subject:
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    Post subject:
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    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 22 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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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