|
View previous topic :: View next topic
|
| Author |
Message |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
The question is with reference to Syncsort - Retreiving the numeric values
I have used below input data and SORT job:
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ROOT11111 ACU00ACUPUNCTURE
CHILD2 ..ACU00DABB DABBDC
CHILD2 ..ACU00DAB1 DAB1DC
CHILD2 ..ACU00DAB2 DAB2DC
ROOTACU00 ACU00ACUPUNCTURE
CHILD ..ACU00DABB DABBDC
CHILD ..ACU00DAB1 DAB1DC
CHILD ..ACU00DAB2 DAB2DC
ROOT12345 ACU00ACUPUNCTURE
CHILD1 ..ACU00DABB DABBDC
CHILD1 ..ACU00DAB1 DAB1DC
CHILD1 ..ACU00DAB2 DAB2DC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1))
/*
|
I am getting the below output (Not expected)..
| Code: |
ROOT11111 ACU00ACUPUNCTURE
CHILD2 ..ACU00DABB DABBDC
CHILD2 ..ACU00DAB1 DAB1DC
CHILD2 ..ACU00DAB2 DAB2DC
ROOTACU00 ACU00ACUPUNCTURE
CHILD ..ACU00DABB DABBDC
CHILD ..ACU00DAB1 DAB1DC
CHILD ..ACU00DAB2 DAB2DC
ROOT12345 ACU00ACUPUNCTURE
CHILD1 ..ACU00DABB DABBDC
CHILD1 ..ACU00DAB1 DAB1DC
CHILD1 ..ACU00DAB2 DAB2DC
|
How to get the below result (Expected)...
| Code: |
ROOT11111 ACU00ACUPUNCTURE
CHILD2 ..ACU00DABB DABBDC
CHILD2 ..ACU00DAB1 DAB1DC
CHILD2 ..ACU00DAB2 DAB2DC
ROOT12345 ACU00ACUPUNCTURE
CHILD1 ..ACU00DABB DABBDC
CHILD1 ..ACU00DAB1 DAB1DC
CHILD1 ..ACU00DAB2 DAB2DC
|
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
ramsri,
I dont think the WHEN=GROUP solution posted in the other thread will give you the desired results. Did you try the SYNCTOOL solution posted by me there?
Or If you're looking for a WHEN=GROUP solution, Change your SYSIN as below .
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'ROOT'),PUSH(81:5,5))
OUTFIL INCLUDE=(81,5,FS,EQ,NUM),BUILD=(1,80)
/* |
BTW you could have replied to the same topic instead of starting off a new topic. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, somewhere I read that one should not open a very old thread....not sure. I thought it was achievable using WHEN=GROUP...
Ok....Thanks. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, I tested it with both
| Code: |
OUTFIL INCLUDE=(81,5,FS,EQ,NUM),BUILD=(1,80)
|
and
| Code: |
OUTFIL INCLUDE=(81,5,ZD,EQ,NUM),BUILD=(1,80)
|
Why to use FS? Any specific reason?
Thanks. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| I thought it was achievable using WHEN=GROUP |
Is it working now??
| Quote: |
| Why to use FS? Any specific reason? |
We just need a character numeric check here and FS will do exactly that. ZD will check for zoned decimal numerics. Both should work fine, but in this case only FS is required. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Oh...Yeah......it is working. The solutions given by you can't go wrong  |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, Why the the piece of code fails?
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1))
OUTFIL INCLUDE=(81,1,ZD,GT,0),BUILD=(1,80)
/*
|
I don't understand why it applies number to the CHARACTER data (ROOTACU00) where as the condition looks for "5,5,ZD,EQ,NUM !
Thanks. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Ramsri,
It's not failing. It is just doing whatever it has been asked to do.
| Code: |
| BEGIN=(1,4,CH,EQ,C'ROOT',AND,5,5,ZD,EQ,NUM),PUSH(81:ID=1)) |
will identify the start of a new GROUP whenever it encounters a 'ROOTnnnnn' where n=0 thru 9. Remember it does not specify where the GROUP should end. Hence in the above example you have an unwanted GROUP starting with 'ROOTACU00' in between; but the 'PUSH'ing of ID field is continued until the beginning of another 'ROOTnnnnn'. Hope it's clear to you now. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
| Arun, I am happy that my assumption is true. Thanks for the details. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
You're welcome.  |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, is it still possible to code a BEGIN and END to achieve what is achieved with other way around?
Thanks. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Here we dont have anything specific in the input data which identifies the ending of a GROUP. Why do you need a solution using both 'BEGIN' and 'END' when a BEGIN alone would do the same. |
|
| Back to top |
|
 |
ramsri
Active User

Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
I am not looking for the BEGIN and END solution but wanted know if it is possible  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|