CHGDTAARA
Last Post 28 Feb 2013 11:14 AM by Lynne Noll. 17 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Suzie David
Basic Member
Basic Member
Posts:172

--
22 Feb 2013 10:06 AM

Hello everyone,

I have DTAARA with this value:

             Valeur                                               
Position      *...+....1....+....2....+....3....+....4....+....5  
     0       '210213  240113  030113 140213  1ADQSAVE   TAP03   ' 
    50       '  220000220000DSP01     OOONONN   O   1LUNDI1MARDI' 
   100       '1MERCR1JEUDI1VENDR1SAMED1DIMAN1PGMAVANT  EXPSYS   ' 
   150       ' PGMAPRES  EXPSYS    PGMAVANT  EXPSYS    HEBDOAPRE' 
   200       'SADQSAVE   NHEBDO1HEBDO2HEBDO3HEBDO4O20130221ONNON' 
   250       'ON11OO'                                             

i want to change the value like this:

             Valeur                                               
Position      *...+....1....+....2....+....3....+....4....+....5  
     0       '210213  240113  030113 140213  1ADQSAVE   TAP03   ' 
    50       '  200000200000DSP01     OOONONN   O   1LUNDI1MARDI' 
   100       '1MERCR1JEUDI1VENDR1SAMED1DIMAN1PGMAVANT  EXPSYS   ' 
   150       ' PGMAPRES  EXPSYS    PGMAVANT  EXPSYS    HEBDOAPRE' 
   200       'SADQSAVE   NHEBDO1HEBDO2HEBDO3HEBDO4O20130221ONNON' 
   250       'ON11OO'                                             

how can i do that ?

i want to replace 22 by 20 at the second line (50)

thanks in advance

 

 

 

 

Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 10:08 AM
CHGDTAARA DTAARA(dtaaraname (51 2))  VALUE('20')   

Assuming I have the starting position correct... change the dtaaraname to the name of your data area and verify starting position..

Viking
Basic Member
Basic Member
Posts:325
Avatar

--
22 Feb 2013 10:12 AM

If you have TAATOOLS installed, use EDTDTAARA and just type over the values you want to change.

edit:  I just noticed this was posted in the RPG forum.  Are you saying you want to change it from within an RPG program?  If so, declare the data area, use IN to bring it into your program, change the values, and use OUT to put it out again.

taherte
Basic Member
Basic Member
Posts:214

--
22 Feb 2013 10:16 AM
Or, if you have TAATOOLS installed, you can use EDTDTAARA2.
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 10:34 AM

If within RPG - usign ILE RPG you can do the following...

I have a dtaara called TESTDTAARA that is defined to be 1024 characters long...

D SYSDTAARA      UDS          1024    DTAARA(TESTDTAARA)     
D  Seq1                          6                           
D                                1                           
D  Seq2                          6                           
D                                1                           
D  Seq3                          6                           
D                                1                           
D  Seq4                          6                           
D                                1                           
D  Val2Change            51     52          
...
 IN SYSDTAARA;       
 Val2Change = '20';  
 OUT SYSDTAARA;                       

I created the data structure (DS)  to SYDTAARA to show the correlation between the actual data area - they can be the same name.

Suzie David
Basic Member
Basic Member
Posts:172

--
22 Feb 2013 11:08 AM
thks
is that easy way by command line with CHGDTAARA
i did not have taatools

thks
Ringer
Veteran Member
Veteran Member
Posts:1724
Avatar

--
22 Feb 2013 11:13 AM
Of if you own DBU, type DBUDTA TESTDTAARA and change it on the screen.

Chris Ringer
Suzie David
Basic Member
Basic Member
Posts:172

--
22 Feb 2013 11:33 AM
Thanks all of you i get it now
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 12:12 PM
Posted By Suzie David on 22 Feb 2013 12:08 PM
thks
is that easy way by command line with CHGDTAARA
i did not have taatools

thks

The CHGDTAARA is command line - and it is part of IBM i.
Barbara Morris
Senior Member
Senior Member
Posts:5193

--
22 Feb 2013 03:37 PM
Posted By Rocky Marquiss on 22 Feb 2013 11:34 AM .
...
 IN SYSDTAARA;       
 Val2Change = '20';  
 OUT SYSDTAARA;                       

A little correction:

IN *LOCK SYSDTAARA; 
 
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 03:39 PM
Probably a good idea - but my code works - and in that short time not likely to run into a timing issue... :)
Scott Klement
Editorial Staff Member
Editorial Staff Member
Posts:16270
Avatar

--
22 Feb 2013 04:36 PM

In addition to Barbara's change, I would also remove the U from "UDS" on your DS definition.   It doesn't need to be there, and is causing unnecessary work for the program.

Barbara Morris
Senior Member
Senior Member
Posts:5193

--
22 Feb 2013 04:38 PM
Posted By Rocky Marquiss on 22 Feb 2013 04:39 PM
Probably a good idea - but my code works - and in that short time not likely to run into a timing issue... :)
Rocky, if this was a reply to my suggestion to use *LOCK on the IN, it wasn't really a suggestion. RPG doesn't allow you to do an OUT unless you use *LOCK on the IN. Except for the *LDA data area ...
Barbara Morris
Senior Member
Senior Member
Posts:5193

--
22 Feb 2013 04:47 PM
Ohhhhh - I just saw Scott's post.

I didn't notice the UDS. That does the equivalent of the *LOCK IN. Rocky, that's why your program was working. You didn't need the IN at all.

There was no timing issue the way you had it. After the data area was locked during the *INIT phase of the RPG cycle, it wouldn't be possible to change the data area from another job until the program reached the OUT opcode.
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 04:51 PM
 
Removed content - couldn't figure out how to delete post....
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 04:52 PM
Posted By Scott Klement on 22 Feb 2013 05:36 PM

In addition to Barbara's change, I would also remove the U from "UDS" on your DS definition.   It doesn't need to be there, and is causing unnecessary work for the program.


I tried that originally - and it wouldn't run - perhaps if I had the *LOCK on the IN statement it would've worked without the U in UDS.... it said it wasn't allocated for write operations.
Rocky Marquiss
Senior Member
Senior Member
Posts:2905

--
22 Feb 2013 04:54 PM
Posted By Barbara Morris on 22 Feb 2013 05:47 PM
Ohhhhh - I just saw Scott's post.

I didn't notice the UDS. That does the equivalent of the *LOCK IN. Rocky, that's why your program was working. You didn't need the IN at all.

There was no timing issue the way you had it. After the data area was locked during the *INIT phase of the RPG cycle, it wouldn't be possible to change the data area from another job until the program reached the OUT opcode.

Ok - that makes sense... I thought I was doing an extra step but couldn't figure out what that step was...
Lynne Noll
Senior Member
Senior Member
Posts:6567

--
28 Feb 2013 11:14 AM
UDS on anything permanent can cause contention between programs; you may not see this until you install in productoin. The program will hold a lock on the data area.

The UDS works fine for the *LDA (which acts like something in QTEMP) because there is no contention, but I wouldn't use it for anything else.
You are not authorized to post a reply.

Acceptable Use Policy