View previous topic :: View next topic
|
Author |
Message |
Chanchal Majumder
New User
Joined: 09 Jul 2012 Posts: 10 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Chanchal Majumder
New User
Joined: 09 Jul 2012 Posts: 10 Location: INDIA
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 ... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Chanchal Majumder
New User
Joined: 09 Jul 2012 Posts: 10 Location: INDIA
|
|
|
|
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 |
|
|
Chanchal Majumder
New User
Joined: 09 Jul 2012 Posts: 10 Location: INDIA
|
|
|
|
I am using
'$$DD01 UPDATEALL EDITALL=(X'020100715C' X'099991231C' 74)'
But this is not working |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 ). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
|