|
View previous topic :: View next topic
|
| Author |
Message |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Hi,
My input file is :
20100901021430|TESTING TESTING 123|1234567890123456
20100901031531|TESTING TESTING 234|-123456789012345
20100901031531|TESTING TESTING 234|-123456745345345
20100901041531|TESTING TESTING 345|1297977890123456
Output file:
20100901021430TESTING TESTING 123+1234567890123456
20100901031531TESTING TESTING 234-123456789012345
20100901031531TESTING TESTING 234-123456745345345
20100901041531TESTING TESTING 345+1297977890123456
Sort card:
SORT FIELD=COPY
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),
%01=(ENDBEFR=C'|',FIXLEN=100),
%02=(FIXLEN=17)),
BUILD=(%00,%01,%02)
OUTREC BUILD=(1,14,UFF,M11,LENGTH=14,
15,100,
115,17,SFF,EDIT=(STTTTTTTTTTTTTTTT),SIGNS=('+','-'))
1st field is 14 digits, number(14)
2nd field 100 characters(100)
3rd fled sign leading value(17)
This is working fine for 3rd fled sign leading value(17).
I have changed to length of the 3rd field to 18.
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),
%01=(ENDBEFR=C'|',FIXLEN=100),
%02=(FIXLEN=18)),
BUILD=(%00,%01,%02)
OUTREC BUILD=(1,14,UFF,M11,LENGTH=14,
15,100,
115,18,SFF,EDIT=(STTTTTTTTTTTTTTTTT),SIGNS=('+','-'))
In this case its not working... output is:
20100901021430TESTING TESTING 123+1234567890123456
20100901031531TESTING TESTING 234+123456789012345
20100901031531TESTING TESTING 234+123456745345345
20100901041531TESTING TESTING 345+1297977890123456
It provided the output as all the postitve values for 3rd field....
Is the 17 length(including sign) is the limit in SORT or am i missing anything here.... Please suggest.... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
When I run your job with DFSORT using 18 instead of 17, I do get the positive and negative values, like this:
| Code: |
20100901021430TESTING TESTING 123 ... +01234567890123456
20100901031531TESTING TESTING 234 ... -00123456789012345
20100901031531TESTING TESTING 234 ... -00123456745345345
20100901041531TESTING TESTING 345 ... +01297977890123456
|
So I can't tell what you're doing differently. Please post the //SYSOUT messages from both runs.
BTW, you don't need INREC and OUTREC to do this. You can just use an INREC statement like this:
| Code: |
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),
%01=(ENDBEFR=C'|',FIXLEN=100),
%02=(FIXLEN=18)),
BUILD=(%00,UFF,M11,LENGTH=14,
%01,
%02,SFF,EDIT=(STTTTTTTTTTTTTTTTT),SIGNS=('+','-'))
|
| Quote: |
| Is the 17 length(including sign) is the limit in SORT |
No, it isn't. |
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Thanks Frank for the suggestion...
Could you please check in the below scenario....
Input:
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
Am getting the below output:
20100901021430TESTING TESTING 123 +00123456789012345
20100901031531TESTING TESTING 234 +00123456789012345
20100901031531TESTING TESTING 234 -00123456745345345
20100901041531TESTING TESTING 345 +00129797789012345
Required Output:
20100901021430|TESTING TESTING 123|+12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|+12979778901234567
SORTCARD:
SORT FIELDS=COPY
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),
%01=(ENDBEFR=C'|',FIXLEN=20),
%02=(FIXLEN=18)),
BUILD=(%00,UFF,M11,LENGTH=14,
%01,
%02,SFF,EDIT=(STTTTTTTTTTTTTTTTT),SIGNS=('+','-'))
I need 3rd field length as 18 (sign + 17 digits)... Please suggest... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm going to take an educated guess that your input is different than it appears in your example. You aren't using BBCode tags so it's difficult to see what your input really looks like, but I'm guessing that there are blanks between the | and third number, e.g. |bb12345678901234567. That would explain the output you get because FIXLEN=18 would NOT give you all of the digits if there are blanks before them.
Try using:
That should give you all of the digits instead of truncating them. See if that gives you the output you want.
And please learn to use BBCode tags. |
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
| Code: |
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
|
There are no spaces in the 3rd field
"12345678901234567" (17 digits),
"-12345678901234567" (sign + 17 digits)
Frank, i can't use the length 25 because output of this SORT step will be given to next step which is a productionised. Hence i consdered the length as 18 (sign + 17 digits)...Please suggest... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Using FIXLEN=25 has no effect on the length of the output field ... that's controlled by the EDIT mask which has sign + 17 digits.
Did you even try using FIXLEN=25?
If there are no spaces in the 3rd field, then I don't know how you're getting the results you're getting. That's certainly not what I get with DFSORT.
I can't because I don't know what it is you're NOT telling me about your data or job.
Please post your input and output records using code tags so I can see what it really looks like. Post the complete JES messages from your run.
If you like, you can send me the information offline ([email protected]) as plain text (.txt) files. Until I know what you're doing that doesn't correspond to what I see in your posts, I can't help you. |
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Hi Frank....
I tried with FIXLEN=25. Please input and output details below.
I have attached the job messages with this.
INPUT:
| Code: |
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
|
OUTPUT:
| Code: |
20100901021430TESTING TESTING 123 +00123456789012345
20100901031531TESTING TESTING 234 +00123456789012345
20100901031531TESTING TESTING 234 -00123456745345345
20100901041531TESTING TESTING 345 +00129797789012345
|
| Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
/*
//SORTOUT DD DSN=MAGT.SORT.OUTPUT,
// DISP=(,CATLG),
// SPACE=(CYL,(10,10))
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=14),
%01=(ENDBEFR=C'|',FIXLEN=20),
%02=(ENDBEFR=C'|',FIXLEN=25)),
BUILD=(%00,%01,%02)
OUTREC BUILD=(1,14,UFF,M11,LENGTH=14,
15,20,
35,18,SFF,EDIT=(STTTTTTTTTTTTTTTTT),SIGNS=('+','-'))
/*
|
|
|
| Back to top |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
| nareshdacha wrote: |
| I have attached the job messages with this. |
No, you didn't.
As a sanity check, running the exact code as you've posted, I get this output as a result:
| Code: |
20100901021430TESTING TESTING 123 +12345678901234567
20100901031531TESTING TESTING 234 -12345678901234567
20100901031531TESTING TESTING 234 -12345674534534577
20100901041531TESTING TESTING 345 +12979778901234567
|
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
And the requested/required messages still not posted. . .
d |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Naresh,
I received your JCL and //SYSOUT messages offline.
When I run your job with DFSORT, I get the expected results as follows:
| Code: |
20100901021430TESTING TESTING 123 +12345678901234567
20100901031531TESTING TESTING 234 -12345678901234567
20100901031531TESTING TESTING 234 -12345674534534577
20100901041531TESTING TESTING 345 +12979778901234567
|
However, the WER messages indicate you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. If Syncsort is producing the wrong results, I certainly can't help you with that.
In the future, please post in the Syncsort Forum, not the DFSORT Forum. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Now, you need to post the requested information from the sysout. . .
From what i can see, Syncsort is not giving the incorrect result - it is doing exactly as you coded. . .
It is not a product problem when one codes for a different product. . .
Suggest you look at the Syncsort documentation. . . |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| From what i can see, Syncsort is not giving the incorrect result - it is doing exactly as you coded. . . |
Why do you say that? %02 should be set with the following values left-justified in 25 bytes:
| Code: |
12345678901234567
-12345678901234567
-12345674534534577
12979778901234567
|
The BUILD then places these values in the INREC record starting at position 35 (still left-justified in 25 bytes):
35,18,SFF,EDIT=(STTTTTTTTTTTTTTTTT),SIGNS=('+','-')) in OUTREC
uses SFF to extract the digits starting from position 35 for 18 bytes. Since the digits are left-justified, that would include all of the digits. They should then be edited to:
| Code: |
+12345678901234567
-12345678901234567
-12345674534534577
+12979778901234567
|
That's what DFSORT does.
The OP said he got the following instead:
| Code: |
+00123456789012345
+00123456789012345
-00123456745345345
+00129797789012345
|
Note that the OP did not use the exact job I suggested, but his version should give the same results.
Are you saying that these control statements are documented to work differently for Syncsort then for DFSORT? How? |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| nareshdacha wrote: |
Input:
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
.
.
.
Required Output:
20100901021430|TESTING TESTING 123|+12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|+12979778901234567
|
Here is a SyncSort for z/OS 1.3 job that will produce the requested output:
| Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TESTING TESTING 123|12345678901234567
20100901031531|TESTING TESTING 234|-12345678901234567
20100901031531|TESTING TESTING 234|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(1,35,
36,18,SFF,M25,LENGTH=18,SIGNS=(+,-,,))
/* |
|
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Thanks Frank, Dick and Alissa for your suggestions ........
Am sorry that i was posted this question in DFSORT.......
My input file is a pipe (|) delimited file and i know the maximum length of the each field. Every record doesn't have the maximum value.
1st field length =14
2nd field length=20
3rd field length=18 (sign + 17digits)
For example, my input will be like this.
| Code: |
20100901021430|TEST|12345678901234567
20100901031531|TESTING|-12345678901234567
20100901031531|TESTING123|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
20100901031531|TESTING123|-3456
20100901041531|TESTING TESTING 345|179
20100901031531|TESTING|-123456
|
Since i dont know the exact length of the field of the record i cannot use OUTREC in this scenario. Hence i used INREC PARSE to split the file based on the pipe symbol.
Please suggest how to proceed further.... |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| Code: |
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20100901021430|TEST|12345678901234567
20100901031531|TESTING|-12345678901234567
20100901031531|TESTING123|-12345674534534577
20100901041531|TESTING TESTING 345|12979778901234567
20100901031531|TESTING123|-3456
20100901041531|TESTING TESTING 345|179
20100901031531|TESTING|-123456
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=18)),
BUILD=(%1,%2,%3,SFF,M25,SIGNS=(+,-,,))),
IFTHEN=(WHEN=INIT,BUILD=(1,34,36,18,JFY=(SHIFT=LEFT))) |
The following output will be produced from the sort step above:
| Code: |
20100901021430TEST +12345678901234567
20100901031531TESTING -12345678901234567
20100901031531TESTING123 -12345674534534577
20100901041531TESTING TESTING 345 +12979778901234567
20100901031531TESTING123 -3456
20100901041531TESTING TESTING 345 +179
20100901031531TESTING -123456 |
|
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Thanks Alissa.. Its working............
I have tried like below (without IFTHEN second time).when i try to use JFY OR SQZ options for shiftig the digits left side its throwing the error..
| Code: |
//STEP2 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TEST|12345678901234567|TEST1|A
20100901031531|TESTING|-12345678901234567|TEST|B
20100901031531|TESTING123|-12345674534534577|TEST2|C
20100901041531|TESTING TESTING 345|12979778901234567|TEST|D
20100901031531|TESTING123|-3456|TEST3|E
20100901041531|TESTING TESTING 345|179|TEST|F
20100901031531|TESTING|-123456|TEST4|G
//SORTOUT DD DSN=A516549.VISA.FSLCV003.NEW.OUT,
// DISP=(NEW,CATLG),DCB=(RECFM=FB,LRECL=80),
// SPACE=(CYL,(10,10))
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=18), %4=(ENDBEFR=C'|',FIXLEN=05),
%5=(ENDBEFR=C'|',FIXLEN=01)),
BUILD=(%1,%2,%3,SFF,M25,JFY=(SHIFT=LEFT),SIGNS=(+,-,,),%4,%5))
|
Message in the output:
| Code: |
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=18),
%4=(ENDBEFR=C'|',FIXLEN=05),
%5=(ENDBEFR=C'|',FIXLEN=01)),
BUILD=(%1,%2,%3,SFF,M25,JFY=(SHIFT=LEFT),SIGNS=(+,-,,),
%4,%5))
*
WER268A INREC STATEMENT : SYNTAX RROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
Am i missing anything here...... |
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
| Sorry.. Those are messages in the SYSOUT |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| nareshdacha wrote: |
Thanks Alissa.. Its working............
I have tried like below (without IFTHEN second time).when i try to use JFY OR SQZ options for shiftig the digits left side its throwing the error..
| Code: |
WER268A INREC STATEMENT : SYNTAX RROR |
Am i missing anything here...... |
Yes, you need to put back the second IFTHEN statement. See below:
| Code: |
//STEP2 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TEST|12345678901234567|TEST1|A
20100901031531|TESTING|-12345678901234567|TEST|B
20100901031531|TESTING123|-12345674534534577|TEST2|C
20100901041531|TESTING TESTING 345|12979778901234567|TEST|D
20100901031531|TESTING123|-3456|TEST3|E
20100901041531|TESTING TESTING 345|179|TEST|F
20100901031531|TESTING|-123456|TEST4|G
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=18),
%4=(ENDBEFR=C'|',FIXLEN=05),
%5=(ENDBEFR=C'|',FIXLEN=01)),
BUILD=(%1,%2,%3,SFF,M25,SIGNS=(+,-,,),%4,%5)),
IFTHEN=(WHEN=INIT,BUILD=(1,34,35,19,JFY=(SHIFT=LEFT),54,6))
/* |
Here is the output produced:
| Code: |
20100901021430TEST +12345678901234567 TEST1A
20100901031531TESTING -12345678901234567 TEST B
20100901031531TESTING123 -12345674534534577 TEST2C
20100901041531TESTING TESTING 345 +12979778901234567 TEST D
20100901031531TESTING123 -3456 TEST3E
20100901041531TESTING TESTING 345 +179 TEST F
20100901031531TESTING -123456 TEST4G |
|
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
Alissa....
Without IFTHEN for second time it will work. Please see the below code...
In my actual scenario there are 37 fields so i need to check the position and length for each field. Hence i used directly BUILD section as below.
| Code: |
//STEP2 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TEST|12345678901234567|TEST1|A
20100901031531|TESTING|-12345678901234567|TEST|B
20100901031531|TESTING123|-12345674534534577|TEST2|C
20100901041531|TESTING TESTING 345|12979778901234567|TEST|D
20100901031531|TESTING123|-3456|TEST3|E
20100901041531|TESTING TESTING 345|179|TEST|F
20100901031531|TESTING|-123456|TEST4|G
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=18),
%4=(ENDBEFR=C'|',FIXLEN=05),
%5=(ENDBEFR=C'|',FIXLEN=01)),
BUILD=(%1,%2,%3,SFF,M25,SIGNS=(+,-,,),%4,%5))
/*
|
Output:
| Code: |
20100901021430TEST +12345678901234567TEST1A
20100901031531TESTING -12345678901234567TEST B
20100901031531TESTING123 -12345674534534577TEST2C
20100901041531TESTING TESTING 345 +12979778901234567TEST D
20100901031531TESTING123 -3456TEST3E
20100901041531TESTING TESTING 345 +179TEST F
20100901031531TESTING -123456TEST4G
|
But when i try use JFY=(SHIFT=LEFT) in the BUILD section(specified below) its throwing syntax error. I have tried SQZ and JFY. For both options its throwing syntax error.
| Code: |
BUILD=(%1,%2,%3,SFF,M25,JFY=(SHIFT=LEFT),SIGNS=(+,-,,),%4,%5))
|
Here i want to do left alignment for 3rd field. Please suggest. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| nareshdacha wrote: |
| Without IFTHEN for second time it will work. |
Yes, I know.
| nareshdacha wrote: |
But when i try use JFY=(SHIFT=LEFT) in the BUILD section(specified below) its throwing syntax error. I have tried SQZ and JFY. For both options its throwing syntax error... Here i want to do left alignment for 3rd field. Please suggest. |
So put back the second IFTHEN statement. What is the problem here? |
|
| Back to top |
|
 |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
In my actual scenario there are 37 fields for 25 different files so i need to check the position and length for each field. Hence i thought that if i directly use BULID no need to calculate the next position of the field so it will reduce some effort as i have to code the same for 25 files (37 to 41 fields each).
If any option is there in BUILD to align the numbers (LEFT) please suggest how to proceed...... |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Rather than dragging this on and on, suggest you either use the provided solution or start writing a program that will do what you want.
Sometimes, one just has to do a bit of typing/cloning.
Someone may have an alternate suggestion that will relieve you of the effort, but in the meantime, it would probably be better to make some progress. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|