View previous topic :: View next topic
|
Author |
Message |
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
I have a file where in there are a number of detail records(identified by '20' in the first two bytes) and a single trailer record(identified by '30' in the first two bytes). In the trailer record, I need to populate the bytes 3-7 (at position 3 of length 5 bytes) in the packed decimal format S9(9) COMP-3 that would contain the total number of type '20' records.
My file looks like:
Code: |
209000001360117005 BP YN
205319191360115002 BP YN
205319390000004010 DV NN
205319390000001016 DV NN
209000001360121007 BP YN
30
|
How can we do this using SORT ? I do not want to use ICEMAN/ICETOOL/SYNCSORT.
Thanks in advance ! |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Try COBOL, Assembler, PLI or REXX....... |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Using COBOL/REXX program is ruled out... looking for some way to do it only using SORT |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OMIT COND=(1,2,CH,EQ,C'30')
OUTFIL REMOVECC,
TRAILER1=('30',COUNT=(TO=PD,LENGTH=5))
/*
|
Quote: |
How can we do this using SORT ? I do not want to use ICEMAN/ICETOOL/SYNCSORT. |
Hmmm ... what exactly do you mean by "SORT"? "ICEMAN" is an alias for DFSORT, Syncsort and CA-Sort. PGM=ICEMAN is the same as PGM=SORT. DFSORT is certainly not Syncsort, but it is ICEMAN. ICETOOL is part of DFSORT. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Who makes such "rules"?
I suspect that most of the people posting topics on these forums have "programming" somewhere in their job description. How is then "ruling out" code as an alternative justified (or even tolerated)?
While i'm very much in favor of using our tools and their special features, i'm not in favor of someone handing out assignments with "Ok, Joe Programmer - here's a coding task that you are not allowed to write code for". How silly! |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Thanks Frank for the reply.
Is it possible to achieve the above using PGM=SORT ? |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Dick, your concern is very valid !
Quote: |
Who makes such "rules"?
I suspect that most of the people posting topics on these forums have "programming" somewhere in their job description. How is then "ruling out" code as an alternative justified (or even tolerated)? |
Its the requirements that drive such rules. Even Iam a programmer but have to follow the requirements that Iam provided with.
My intent of posting the query was to take some help from experts and not to start a chain of debates and fiery replies.
Anyways, thanks Dick for you advice !!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Is it possible to achieve the above using PGM=SORT ? |
Just use PGM=SORT instead of PGM=ICEMAN in the job I showed ... it's the same thing!
Code: |
//S1 EXEC PGM=SORT
.... everything else is the same
|
|
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Thanks Frank ! Hope that helps !
Sorry for missing that part about PGM=SORT.
Thanks again ! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello tarunbhardwajleo,
You're welcome
However, I've not yet seen a user requirement that specified that their objective must not be coded in a program
Good luck. |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Hi Frank,
I tried executing the SORT step as coded by you but Iam getting the following message:
Code: |
SYSIN :
OPTION COPY
OMIT COND=(1,2,CH,EQ,C'30')
OUTFIL REMOVECC,
TRAILER1=('30',COUNT=(TO=PD,LENGTH=5))
*
/*
*
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
|
Could you pls help me out with it ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please note that you are using Syncsort. You can tell that from the "WER" messages. At many sites, executing ICEMAN actually invokes Syncsort, not the IBM product. That appears to be what is happening with your job.
Frank's solution is for DFSORT. The control statements for both sorts are not the same. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
tarunbhardwajleo,
The job runs fine with DFSORT. As Dick pointed out, 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 you or anyone else on this board would like some documents prepared by the DFSORT Team that describe what we see as the advantages of DFSORT over Syncsort, as well as considersations for migrating from Syncsort to DFSORT, send me an e-mail offline (yaeger@us.ibm.com). Please put "DFSORT" somewere in your Subject line to catch my attention. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
With Syncsort, this:
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD *
1
2
3
4
5
6
//SORTOUT DD SYSOUT=*
//SORTOUT1 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=('30',COUNT)
/* |
gives:
and
Code: |
SYSIN :
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=('30',COUNT)
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I SORTOUT : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER405I SORTOUT : DATA RECORDS OUT 6; TOTAL RECORDS OUT
WER054I RCD IN 6, OUT 6
WER169I RELEASE 1.1D BATCH 0426 TPF LEVEL 3A
WER052I END SYNCSORT - MSRDSSRT,STEP1,,DIAG=A800,EAC8,8006,244C,E0EA |
If time permits later tonight, i'll try to look into making the count PD. Feel free to have a go at it yourself - other than a bit of machine time it won't cost you anything to experiment |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Hi Dick,
Thanks for your assistance. Just one last query, is it possible to have COUNT in packed decimal format that start from position (after'30') and has length 5 bytes? Thats S9(9) comp-3.
Thanks in advance ! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
If Syncsort will do it, i'm not sure how to do it directly. That's what i had hoped to look into last night, but ran out of time.
While it would be tedious, additional steps could be added to separate and reformat the "trailer" so the count would be converted to packed-decimal.
After the reformat, the 2 files could then be combined putting the trailer back together with the data records.
Seems like a real waste of both people and machine resources to do it this way.
Maybe someone has experience generating a trailer with a packed-decimal count in the trailer record using Syncsort. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
tarunbhardwajleo wrote: |
Thanks for your assistance. Just one last query, is it possible to have COUNT in packed decimal format that start from position (after'30') and has length 5 bytes? Thats S9(9) comp-3. |
Have you checked your Syncsort manual? |
|
Back to top |
|
|
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
yeah, I checked it but couldn't get a break thru with it. COUNT is an 8 digit right justified field with leading zeros suppressed. Iam just trying to figure out a way to convert it to PD S9(9) comp-3. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Another thought that comes to mind is to run the "copy" creating only the trailer. Then, reformat the trailer from what you have to PD. Lastly combine the 2 files into one. |
|
Back to top |
|
|
|