View previous topic :: View next topic
|
Author |
Message |
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
Hi,
I have following requirement. I have file with one record.
Now I need to replecate 100 records as a test data for my testing but in only in particualr record position (i.e. 134th position I want to change the values from X'00', X'01', X'02', ….X'99')
Any idea if we can do it using sort card? If I want to increment and write the records using cobol program how to do it?
Regards,
Neil |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Almost certainly can be done in Sort as well.
In Cobol
Code: |
01 w-two-bytes-for-one-byte-binary comp pic s9(4) value zero.
01 filler redefines w-two-bytes-for-one-byte-binary.
05 filler pic x.
05 w-one-byte-binary pic x. |
Every time you want to write a record:
Code: |
add +1 to w-two-bytes-for-one-byte-binary
move w-one-byte-binary to record-field-position-whatever |
|
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi Neil,
Please provide some input and output samples. based on what criteria you will select records. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Rats. Just looked more closely at your sample. You don't want Hex, it looks like, you want decimal but with no sign, despite the subject.
A subtle change, then:
In Cobol
Code: |
01 w-two-bytes-for-one-byte-binary comp-3 pic s99v9 value zero.
01 filler redefines w-two-bytes-for-one-byte-binary.
05 w-one-byte-binary pic x.
05 filler pic x. |
Note the field being redefined is now comp-3 and has a decimal place (only for alignment) and the filler subordinate to the redefines is now the last field.
Every time you want to write a record:
Code: |
add +1 to w-two-bytes-for-one-byte-binary
move w-one-byte-binary to record-field-position-whatever |
|
|
Back to top |
|
|
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
Thanks Bill However do you have an example on how to do it using sort?
Sai:-
My input record looks as below
0110H (506869815..0.10551000.è...27
The Xex Value of the .(dot) after 0 is X'01'
Now I want to replcate same records but to increment the X'01' to X'02' till X'99' and then do the testing
How can I replicate using sort?
Reagrds,
Neil |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What do you mean "however"? If you wanted to do it in Sort, why didn't you ask in the appropriate forum (JCL for Synsort, DFSORT for, er..., DFSORT)? You asked for a Cobol solution in the Cobol forum.
You mess up the subject, get two Cobol solutions, and all you can say is "However"? :-)
Fortunately Sai is handy.
You can do it the same way (either the first or the second) in Sort. You have some code to generate extra records, or you want that as well?
Get a sequence value, ten times bigger than it need be, in a PD field, beyond the end of your fixed-length record, say, 180,2,PD. Then, in your output, access 180,1,CH. |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi Neil,
Please use below mentioned SORT CARD.
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+---
506869815..0 10551000.è...27
/*
//SORTOUT DD DSN=<output file>,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(100,200),RLSE),
// DCB=(RECFM=FB,LRECL=80)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,REPEAT=100,
OUTREC=(1:1,12,13:SEQNUM,1,BI,START=1,INCR=1,14:14,67)
/* |
Input:
Code: |
----+----1----+----2----+----3----+----4-
506869815..0 10551000.è...27
FFFFFFFFF44F0FFFFFFFF45444FF4444444444444
506869815BB0110551000B4BBB270000000000000 |
Output:
Code: |
----+----1----+----2----+----3----+----4
----+----F----+----F----+----F----+----F
----+----1----+----2----+----3----+----4
---------------------------------------
506869815..0.10551000.è...27
FFFFFFFFF44F0FFFFFFFF45444FF444444444444
506869815BB0110551000B4BBB27000000000000
---------------------------------------
506869815..0.10551000.è...27
FFFFFFFFF44F0FFFFFFFF45444FF444444444444
506869815BB0210551000B4BBB27000000000000
---------------------------------------
506869815..0.10551000.è...27
FFFFFFFFF44F0FFFFFFFF45444FF444444444444
506869815BB0310551000B4BBB27000000000000
---------------------------------------
506869815..0.10551000.è...27
FFFFFFFFF44F0FFFFFFFF45444FF444444444444
506869815BB0410551000B4BBB27000000000000 |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Neil,
Do you want to start from x'00' or x'01'? You've said both.
Can you confirm that it is an "unsigned decimal" that you want, ie none of those nasty hexy letters? Or is that what you do want? Nasty hexy letters? |
|
Back to top |
|
|
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
Thanks Sai & Bil for your quick help.
But it seems the SORT products in out shop does not support below mentioned syntax as I got below error after running the exact same job as given by sai.Please find below error
PRODUCT LICENSED FOR CPU SERIAL NUMBER 6682E, MODEL 2086 230
SYSIN :
WER164B 1,028K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,000K BYTES USED
WER146B 24K BYTES OF EMERGENCY SPACE ALLOCATED
WER267A SORT STATEMENT : STATEMENT NOT FOUND |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Neil,
The most likely thing is you've accidently clobbered the cards provided somehow. Can you show what you are running, both in your JCL and on the output from the sort? Any outstanding answers you care to give would be good as well. |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Neil,
The sort card i provided is for DFSORT. In your shop you are using SYNCSORT. Please check the command in SYNCSORT to repeat records. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
nileshyp wrote: |
WER267A SORT STATEMENT : STATEMENT NOT FOUND |
|
|
Back to top |
|
|
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
Hi,
I tried the way Bill suggested using a COBOL program and it worked fine.
Regards,
Neil |
|
Back to top |
|
|
|