Change command in Syncsort



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 2:18 am

I use syncsort in JCL to copy a dataset to another file.
However, I have 3 fields that I don't want copy their values to new file, but just reset their value.
Here is the definition of those 3 fields:
Field-A pic s9(3) comp-3. (want to change the value to 000)
Field-B pic s9(3) comp-3. (want to change the value to 000)
Field-C pic x(1). (want to change the value to space)

field A start at position 2441.
I tried the command CHANGE=(2441,2,PD,000) but it doesn't work.

Please help! Thanks

Newbie to mainframe.
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

 

Re: Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 2:34 am

I also tried to use When...Overlay...but I got a syntax error, I think my work doesn't have DFSORT, only SYNCSORT
Here is my sample

SORT FIELDS=COPY                                 
       OMIT COND=((1,2,PD,EQ,40,OR,1,2,PD,EQ,50),
             OR,(3,2,PD,EQ,109,OR,3,2,PD,EQ,199))
       OUTREC IFTHEN=(WHEN=(2441,2,PD,EQ,100),   
                     OVERLAY=(2441:000))         

Last 2 lines is where I have problem with, I still want to go with CHANGE= instead of IFTHEN.
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

Postby dick scherrer » Sat Mar 28, 2009 2:35 am

Hello and welcome to the forum,

CHANGE implies changing one value to another (you might use NOMATCH with CHANGE to accomplish what you want).

Suggest you would rather use OVERLAY. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 2:38 am

The field I want to use usually have either value of 100, 50, or 0...So, do I need 3 statements to cover all 3 senerio??

Thank you for responding. I saw example of CHANGE, NOMATCH but only with Characters, not Packed Decimal. Would you please give me an example?

Newbie.
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

Postby dick scherrer » Sat Mar 28, 2009 3:01 am

Hello,

The hex value for a 2-byte packed value of zero is X'000C', the value for +125 is X'125C'.

You could change from any value to zero and then for NOTATCH, force zero.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 3:18 am

Here is my latest version using CHANGE...NOMATCH. However, I still got syntax error :?:

SORT FIELDS=COPY                                 
       OMIT COND=((1,2,PD,EQ,40,OR,1,2,PD,EQ,50),
             OR,(3,2,PD,EQ,109,OR,3,2,PD,EQ,199))
       OUTREC FIELDS=(2441:2441,2,               
                        CHANGE=(2,100,X'000C',   
                                  50,X'000C'),   
                            NOMATCH=(X'000C'))   

Do you know what letter stand of packed decimal...like c is for character, x is for hexadecimal, b is for bytes...
Can you point out to me what's wrong with my statement?

Thanks.
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 3:33 am

I got it to work. Thank you for all your suggestion.

Newbie
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

Postby dick scherrer » Sat Mar 28, 2009 3:36 am

Hello,

Do you know what letter stand of packed decimal...
No, but you don't need this. . . The hex values will work.

CHANGE is to change one value to another. Other than the NOMATCH (which looks ok), the posted change syntax confuses me. What is the 100, the 50? Are these supposed to be packed values?

I'll be away for a few hours, but will check back later. . . I'll also try to have the documentation handy as this has been from memory so far :)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Change command in Syncsort

Postby newbie » Sat Mar 28, 2009 3:57 am

Here is my latest version, (the working version) :lol:
SORT FIELDS=COPY                                   
       OMIT COND=((1,2,PD,EQ,40,OR,1,2,PD,EQ,50), 
             OR,(3,2,PD,EQ,109,OR,3,2,PD,EQ,199)) 
       OUTREC FIELDS=(1:1,2440,                   
                      2441:2441,2,                 
                        CHANGE=(2,X'100C',X'000C'),
                            NOMATCH=(X'000C'),     
                      2443:2443,2,                 
                        CHANGE=(2,X'020C',X'000C'),
                            NOMATCH=(X'000C'),     
                      2445:2445,1,                 
                        CHANGE=(1,C'D',C' '),     
                            NOMATCH=(C' '))
newbie
 
Posts: 6
Joined: Sat Mar 28, 2009 2:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Change command in Syncsort

Postby dick scherrer » Sat Mar 28, 2009 4:38 am

Cool - good to hear it is working - thanks for the update :)

Also, when posting jcl, sort control, program code, etc it is best to use the "Code" tag (see above). This makes the post more readable and preserves alignment that is lost otherwise. There is a Preview that lets you see your post as it will appear to the forum, rather than what you see in the reply editor. Once you are satidfied with how the post looks, Submit. Do not forget to Submit as your post will be lost - i've done that more than once. . . ;)

Packed-decimal leterals - from the manual:
A 'P' denotes a packed decimal constant,
which contains a positive sign and a leading zero when padding is necessary.
This was in a discussion about dates, so i don't know if it is usable with other data.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post